PDA

View Full Version : code problems


ShadowGlance
07-02-2002, 02:44 AM
WTF did i do wrong when creating this script!!!!
thanks!!! i am trying to make an online clock...i left the stuff above my code ou cause i know the problem isnt there... is there a debugger for JScript????

<FORM NAME = "Tick">
<INPUT TYPE = "Text" SIZE = "12" NAME = "Clock">
</FORM>

<SCRIPT LANGUAGE = "JavaScript1.2">

function time()
{
var hand = new Date()
var hours = hand.gethours()
var minutes = hand.getminutes()
var seconds = hand.getseconds()
var dn = "AM"

if (hours>12)
{
dn = "PM"

hours = hours-12
}

if (hours == 0)
hours = 12

if (minutes<=9)
minutes = "0"+minutes

if (seconds<=9)
seconds = "0"+seconds

document.tick.clock.value = hours+ ":" +minutes+ ":" +seconds+ " " dn

setTimeout = ("show()", 1000)
show()
}
</SCRIPT>

</HTML>

Roelf
07-02-2002, 08:42 AM
Your function is called time() and you call it like show() change one of them into the other and it should work

Guardian23
07-02-2002, 01:24 PM
Other than that, if you plan on the function being called without user input, you need to call it outside the function, either through the onload command or right after your function end, in this case the '}' character. :)

Guardian