•
•
•
•
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
![]() |
•
•
Join Date: Jan 2008
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
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.
•
•
Join Date: Jan 2008
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
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()">
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 239
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*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Las Vegas, Nevada
Posts: 83
Reputation:
Rep Power: 1
Solved Threads: 14
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.
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.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
beta blog bon browser browsers browsing competition daniweb development echo email encryption eu europe explorer firefox gecko gentoo gradient graphics html ie7 internet internet explorer internet explorer 7 javascript leak linux memory microsoft mozilla networking news open source open-source opera patch phishing php scams security social software spam super testing users web webmail
- XML Atom feed IE6 and Firefox vs. IE7 problem (RSS, Web Services and SOAP)
- IE7 document.getElementById problem (JavaScript / DHTML / AJAX)
- js doesn't work on IE7 and/or vista (JavaScript / DHTML / AJAX)
- CSS Problem - Firefox vs IE7 (HTML and CSS)
- IE7 New Window Javascript (JavaScript / DHTML / AJAX)
- CSS and IE7 problem in layout (Site Layout and Usability)
- How to make CSS opacity setting work in IE7 ? (JavaScript / DHTML / AJAX)
- Error reading XML file in Javascript (JavaScript / DHTML / AJAX)
- opening pictures in a new window (JavaScript / DHTML / AJAX)
Other Threads in the PHP Forum
- Previous Thread: Download a file which is stored in Server
- Next Thread: Using PHP/HTML to update informationin MySQL



Linear Mode