Jump to content

Help! Not Working!


RockinPurdy

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/86250-help-not-working/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-440606
Share on other sites

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()'>

 

Link to comment
https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-442446
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-442465
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-443018
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/86250-help-not-working/#findComment-443122
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.