Click to See Complete Forum and Search --> : javascript error


zuzupus
07-17-2003, 06:28 AM
when i am using attached tx tfile which is mixture of php and javascript i dotn no why im getting unknown javascript error anybody rectify this will be appreciable

thanks

speciallly in below JS

function show2(){
if (!document.layers && !document.all) return;
if (document.layers) {
document.layers.pendule.document.write("<form name=\"tstest\"><select name=\"bis\" size=\"1\"><option value=\"- - - -\" selected>"+ document.tstest.bis.value +"</option><option value=\"09:00\">09:00</option><option value=\"10:00\">10:00</option><option value=\"11:00\">11:00</option></select></form>");
document.layers.pendule.document.close();
}
else if (document.all)
{
pendule.innerHTML = "<form name=\"tstest2\"><select name=\"bis\" size=\"1\"><option value=\"- - - -\" selected>"+ document.tstest.bis.value +"</option><option value=\"09:00\">09:00</option><option value=\"10:00\">10:00</option><option value=\"11:00\">11:00</option></select></form>"
}
setTimeout("show2()",36000)
}

function show(){
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
if (hours<=9)
hours="0"+ hours
if (minutes<=9)
minutes="0"+minutes
document.tstest.bis.value = ""+ hours +":"+ minutes +""
setTimeout("show()",1000)
}

learninghtml
07-21-2003, 02:51 PM
Do you get an error alert when the page loads?
If so what does it say?

David Harrison
07-21-2003, 03:24 PM
Try changing this:
if (!document.layers && !document.all){return;}
if (document.layers) {

to:
if (!document.layers && !document.all){return;}
else if (document.layers) {

I can't see it having much effect but try it all the same.

Another thing that could be causing it is that you have \" inside ", I think that it should be \" inside ' inside " but I may be wrong.

Also it's interesting that you should choose the ID pendule, did you get this off JavaScript Source (http://www.javascriptsource.com/), or maybe it's just a coincidence.

And again, also why do you want to call show2() every 6 mins? If you meant to do an hour it should be 360000.