Good evening,
Can anyone be so kind as to cast an eye over this code. Having problems getting a combo to populate itself on load so I've had to take it right back to basics i.e. the test function. When the page is loaded no values have been inserted into the combo. Same if I use the RSEXECUTE function which calls a function in a remote script. This "safeload" methodology was taken from an existing forum. Many thanks - Glyn.
<script language="JavaScript" src="_ScriptLibrary/RS.HTM"></script>
<script language="VBScript" src="_ScriptLibrary/datamanager.asp"></script>
<script language="JavaScript">
RSEnableRemoteScripting("/_ScriptLibrary");
</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
// Browser Detection
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;
// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
if (IEmac && IE4) // IE 4.5 blows out on testing window.onload
{
window.onload = SafeOnload;
gSafeOnload[gSafeOnload.length] = f;
}
else if (window.onload)
{
if (window.onload != SafeOnload)
{
gSafeOnload[0] = window.onload;
window.onload = SafeOnload;
}
gSafeOnload[gSafeOnload.length] = f;
}
else
window.onload = f;
}
function SafeOnload()
{
for (var i=0;i<gSafeOnload.length;i++)
gSafeOnload();
}
function test()
{
objTitles = document.all("cboTitle");
for (i = 0; i < 1000000000;i++)
{
objOption = document.createElement ("OPTION");
objOption.Value = "value";
objOption.Text = "text";
objTitles.add objOption;
}
}
// Call the following with your function as the argument
SafeAddOnload("test");
</script>
<script language="VBScript">
function populatetitles()
objTitles = document.all("cboTitles")
set co = RSExecute("datamanager.asp","execspreturndt",rstitle,"title","get_title.xml",nothing,false);
rstitle.movefirst
do until rstitle.eof
set objOption = document.createElement ("OPTION")
objOption.Value = rstitle(0)
objOption.Text = rstitle(0)
objTitles.add objOption
rstitle.movenext
loop
end function
</script>
</head>
<form>
<body>
<td><select size="1" name="cboTitles" id="cboTitle" STYLE="width:300;">
</select></td></html>
</body>
</form>
Can anyone be so kind as to cast an eye over this code. Having problems getting a combo to populate itself on load so I've had to take it right back to basics i.e. the test function. When the page is loaded no values have been inserted into the combo. Same if I use the RSEXECUTE function which calls a function in a remote script. This "safeload" methodology was taken from an existing forum. Many thanks - Glyn.
<script language="JavaScript" src="_ScriptLibrary/RS.HTM"></script>
<script language="VBScript" src="_ScriptLibrary/datamanager.asp"></script>
<script language="JavaScript">
RSEnableRemoteScripting("/_ScriptLibrary");
</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
// Browser Detection
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;
// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
if (IEmac && IE4) // IE 4.5 blows out on testing window.onload
{
window.onload = SafeOnload;
gSafeOnload[gSafeOnload.length] = f;
}
else if (window.onload)
{
if (window.onload != SafeOnload)
{
gSafeOnload[0] = window.onload;
window.onload = SafeOnload;
}
gSafeOnload[gSafeOnload.length] = f;
}
else
window.onload = f;
}
function SafeOnload()
{
for (var i=0;i<gSafeOnload.length;i++)
gSafeOnload();
}
function test()
{
objTitles = document.all("cboTitle");
for (i = 0; i < 1000000000;i++)
{
objOption = document.createElement ("OPTION");
objOption.Value = "value";
objOption.Text = "text";
objTitles.add objOption;
}
}
// Call the following with your function as the argument
SafeAddOnload("test");
</script>
<script language="VBScript">
function populatetitles()
objTitles = document.all("cboTitles")
set co = RSExecute("datamanager.asp","execspreturndt",rstitle,"title","get_title.xml",nothing,false);
rstitle.movefirst
do until rstitle.eof
set objOption = document.createElement ("OPTION")
objOption.Value = rstitle(0)
objOption.Text = rstitle(0)
objTitles.add objOption
rstitle.movenext
loop
end function
</script>
</head>
<form>
<body>
<td><select size="1" name="cboTitles" id="cboTitle" STYLE="width:300;">
</select></td></html>
</body>
</form>