User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,070 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,588 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 909 | Replies: 6
Reply
Join Date: Jan 2008
Posts: 6
Reputation: priddysharp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
priddysharp priddysharp is offline Offline
Newbie Poster

Help Works in Firefox, not in IE7

  #1  
Jan 20th, 2008
Hi, I have written a php/javascript code to check a database for a variable, which is 15 seconds to display something, or 30 seconds. Then it sends the variable to javascript to run the countdown. It works in firefox, but when I try it in IE7, the countdown starts at 10 seconds no matter what.
<script language="JavaScript" type="text/javascript">

<?php

$sqlh = "SELECT * FROM tb_ads WHERE id='$adse'";
$resulth = mysql_query($sqlh);        
$myrowh = mysql_fetch_array($resulth);
$plan = $myrowh["visittime"];

if($plan=="15"){
$time = 16;
}else{
$time = 31;
}

echo "var x = ".$time;
?>

var y = 1

function startClock(){

if(x!=='Done'){

x = x-y

document.frm.clock.value = x

setTimeout("startClock()", 1000)

}

if(x==0){

x='Done';

document.frm.clock.value = x;

success.location.href="success.php?ad="+document.frm.id.value+"&
verify="+document.frm.verify.value;

}}

</script>
Last edited by priddysharp : Jan 20th, 2008 at 5:43 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Posts: 6
Reputation: priddysharp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
priddysharp priddysharp is offline Offline
Newbie Poster

Re: Works in Firefox, not in IE7

  #2  
Jan 21st, 2008
Ok, still no replies. Well, then does anyone know of another way I could do it?
Reply With Quote  
Join Date: Jan 2008
Posts: 6
Reputation: priddysharp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
priddysharp priddysharp is offline Offline
Newbie Poster

Re: Works in Firefox, not in IE7

  #3  
Jan 21st, 2008
Ok so I tested it in IE 7 again, and it still starts the countdown at 9(or 10 - 1). Here is the source code that the browser gets. Why won't it work?
<script language="JavaScript" type="text/javascript">

var x = 31
var y = 1
function startClock(){
if(x!=='Done'){
x = x-y

document.frm.clock.value = x

setTimeout("startClock()", 1000)

}

if(x==0){

x='Done'

document.frm.clock.value = x

success.location.href="success.php?ad="+document.frm.id.value+"&verify="+document.frm.verify.value

}}

</script>

</head>

			
			<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" onLoad="startClock()">
			
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: Works in Firefox, not in IE7

  #4  
Jan 21st, 2008
You need to post this question in javascript forum. I am sure you ll get better help there.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 251
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 13
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: Works in Firefox, not in IE7

  #5  
Jan 21st, 2008
gotta be kidding about this one
180 seconds, now on up to you.

<META HTTP-EQUIV="Refresh" CONTENT="180">

works everywhere. u no need java everytime
Last edited by fatihpiristine : Jan 21st, 2008 at 10:10 pm.
Do a favour, leave me alone
Reply With Quote  
Join Date: Nov 2007
Location: Las Vegas, Nevada
Posts: 83
Reputation: johnsquibb is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

Re: Works in Firefox, not in IE7

  #6  
Jan 21st, 2008
I took the code you pasted above and tested it locally with IE7 and it started the countdown at 30...

check to make sure you don't have an initial value set in your form 'document.frm.clock' element... or aren't setting it anywhere else in the document

as an aside, I would recommend using semicolons at the end of your javascript lines...it makes for much cleaner code.
Reply With Quote  
Join Date: Jul 2008
Posts: 1
Reputation: shedokan is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
shedokan shedokan is offline Offline
Newbie Poster

Re: Works in Firefox, not in IE7

  #7  
Jul 11th, 2008
what is this script for if I may ask.
because I'm searching the same type of script I think.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 12:59 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC