On first execution of StartSurf() the siteloc returns undefined
On second excution and after that there is no problem.
StartSurf is called from a button press, which becomes invisible for 30
seconds and then visible again.
Suggest solution.
The code I am using is
=============== ==========
var siteloc;
var siteid;
var nVar;
var sitesurfed;
function StartSurf()
{
document.getEle mentById('surf2 1').style.visib ility='hidden';
nVar = 30;
callSite()
if (siteloc = "")
{
exitSurf()
}
else
{
callTimer()
}
}
function callTimer()
{
if (nVar >= 0)
{
T1.innerHTML = "<b><font color='#FFFFFF' >" + nVar + "</font></b>";
nVar = nVar - 1;
Timer()
}
else
{
document.getEle mentById('surf2 1').style.visib ility='visible' ;
}
}
function Timer()
{
window.setTimeo ut("callTimer() ", 1000);
}
function callSite()
{
var file = 'surfdb.asp?T=' + Date();
getSurf(file)
var msg1 = "<b><font color='#FFFFFF' ><a style='color: #FFFFFF;
font-size: 10pt; font-weight: ";
msg1 = msg1 + "bold' target='_blank' href='" + siteloc + "'>Open
Site</a></font></b>";
T2.innerHTML = msg1;
var msg5 = "<b><font color='#FFFFFF' >Surfed: " + sitesurfed +
"</font></b>";
T5.innerHTML = msg5;
var msg2 = "<b><font color='#FFFFFF' ><a style='color: #FFFFFF;
font-size: 10pt; font-weight: ";
msg2 = msg2 + "bold' target='_blank' href='reportabu se.asp?siteid=" +
siteid + "'>Report Abuse</a></font></b>";
T3.innerHTML = msg2;
document.getEle mentById('surfF rame').src = siteloc;
}
function getSurf(file)
{
var scriptTag = document.getEle mentById('loadS cript');
var head = document.getEle mentsByTagName( 'head').item(0)
if(scriptTag) head.removeChil d(scriptTag);
script = document.create Element('script ');
script.src = file;
script.type = 'text/javascript';
script.id = 'loadScript';
head.appendChil d(script)
}
function exitSurf()
{
document.getEle mentById('surf2 1').style.visib ility='hidden';
document.getEle mentById('surfF rame').src = "surfcomp.asp?x =" +
Date();
T1.innerHTML = "";
T0.innerHTML = "";
var msg3 = "<b><font color='#FFFFFF' ><a style='color: #FFFFFF;
font-size: 10pt; font-weight: ";
msg3 = msg3 + "bold' href='members.a sp?x=" + Date() + "'>My
Account</a></font></b>";
T2.innerHTML = msg3;
T3.innerHTML = "";
}
=============== =====
--------------------------
My websites
http://www.eecpworld.com/
http://www.indiapropertyhome.com/
http://www.wahmdirect.com/
http://www.indianmatrimonialnet.com/
*** Sent via Developersdex http://www.developersdex.com ***