RockinPurdy Posted January 16, 2008 Share Posted January 16, 2008 Hey, the following works in Firefox, but not in Internet Explorer. Why? <script> var x = 10 var y = 1 function startClock1(){ if(x!=="Done"){ x = x-y document.frm.clock.value = x setTimeout("startClock1()", 1000) } if(x==0){ var adid = getURLParam("id"); var queryString = "?a=" + adid; location.replace("viewdone.php" + queryString); x="Done"; document.frm.clock.value = x } } </script> The "clock" basically doesn't have anything show up in it, and it goes to viewdone.php Quote Link to comment https://forums.phpfreaks.com/topic/86250-help-not-working/ Share on other sites More sharing options...
phpQuestioner Posted January 16, 2008 Share Posted January 16, 2008 what exactly are you trying to get it to do? it counts backwards from 9 in FF & IE; it just throws an error, because getURLParam is not defined. now you may have it defined in some other part of your code; but in the code you provide; that is the error that is being received. Quote Link to comment https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-440606 Share on other sites More sharing options...
RockinPurdy Posted January 16, 2008 Author Share Posted January 16, 2008 Yes, GetURLParam is in another part. It works fine in FF, it counts down from 9 and displays it in the textbox But in IE it doesn't even countdown (at least not visible in the textbox; and it never redirects) Quote Link to comment https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-441214 Share on other sites More sharing options...
phpQuestioner Posted January 16, 2008 Share Posted January 16, 2008 You want the page to redirect when the text box count value reaches 0? Is that what your trying to do? Oh; it's does count down in IE7; I am not sure about IE below that. Quote Link to comment https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-441437 Share on other sites More sharing options...
RockinPurdy Posted January 18, 2008 Author Share Posted January 18, 2008 Uhh.. It's not working in IE7 <script> function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if ( aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return unescape(strReturn); } </script> <script> var x = 10 var y = 1 function startClock1(){ if(x!=="Done"){ x = x-y document.frm.clock.value = x setTimeout("startClock1()", 1000) } if(x==0){ var adid = getURLParam("id"); var queryString = "?a=" + adid; location.replace("viewdone.php" + queryString); x="Done"; document.frm.clock.value = x } } </script> Could it be with: <body leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0' onLoad='startClock1()'> Quote Link to comment https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-442446 Share on other sites More sharing options...
phpQuestioner Posted January 18, 2008 Share Posted January 18, 2008 Uhh.. It's not working in IE7 I don't why it's not working for you in IE7, because I took the code you provided and tested it in IE7 on my computer and it worked fine; it just threw that one error I mentioned, but that occurred in both browsers that I tested it in. Quote Link to comment https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-442465 Share on other sites More sharing options...
RockinPurdy Posted January 18, 2008 Author Share Posted January 18, 2008 Try creating a new HTML file with this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>ShareBux</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <script> function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if ( aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return unescape(strReturn); } </script> <script> var x = 10 var y = 1 function startClock1(){ if(x!=="Done"){ x = x-y document.frm.clock.value = x setTimeout("startClock1()", 1000) } if(x==0){ var adid = getURLParam("id"); var queryString = "?a=" + adid; location.replace("viewdone.php" + queryString); x="Done"; document.frm.clock.value = x } } </script> </head> <body leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0' onLoad='startClock1()'> <table><tr><td width="400"><img src='images/header.jpg' /></td><td><form name="frm"><input type="text" name="clock" size="3" readonly style="border: none; padding: 0; font-size: 25pt; font-weight: bold; font-family: Verdana; vertical-align:top;"></td><td width='300'> </td></tr></table> <iframe src="http://google.ca" id='frame' frameborder="0" border="1" framspacing="0" marginheight="0" marginwidth="0" scrolling="yes" vspace="0" hspace="0" width="100%"></iframe> <script type="text/javascript"> function resizeIframe() { var height = document.documentElement.clientHeight; height -= document.getElementById('frame').offsetTop; // not sure how to get this dynamically height -= 20; /* whatever you set your body bottom margin/padding to be */ document.getElementById('frame').style.height = height +"px"; }; document.getElementById('frame').onload = resizeIframe; window.onresize = resizeIframe; </script> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-443018 Share on other sites More sharing options...
phpQuestioner Posted January 19, 2008 Share Posted January 19, 2008 the problem is that you had two onload events occurring at the same time and one was canceling out the other. try this insteads (tested and works in IE7 & FFv2.0.0.4): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>ShareBux</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <script language="javascript"> function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if ( aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return unescape(strReturn); } </script> <script language="javascript"> var x = 10 var y = 1 function startClock1(){ if(x!=="Done"){ x = x-y document.frm.clock.value = x setTimeout("startClock1()", 1000) } if(x==0){ var adid = getURLParam("id"); var queryString = "?a=" + adid; location.replace("viewdone.php" + queryString); x="Done"; document.frm.clock.value = x } } </script> </head> <body leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0'> <table><tr><td width="400"><img src='images/header.jpg' /></td><td><form name="frm"><input type="text" id="countdown" name="clock" size="3" readonly style="border: none; padding: 0; font-size: 25pt; font-weight: bold; font-family: Verdana; vertical-align:top;"></td><td width='300'> </td></tr></table> <iframe src="http://google.ca" id='frame' frameborder="0" border="1" framspacing="0" marginheight="0" marginwidth="0" scrolling="yes" vspace="0" hspace="0" width="100%"></iframe> <script type="text/javascript"> function resizeIframe() { var height = document.documentElement.clientHeight; height -= document.getElementById('frame').offsetTop; // not sure how to get this dynamically height -= 20; /* whatever you set your body bottom margin/padding to be */ document.getElementById('frame').style.height = height +"px"; } window.onload=function() { startClock1(); setTimeout("resizeIframe()", 1); } window.onresize = resizeIframe(); </script> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-443122 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.