I would like to display a "CountDown Timer" In
an HTML page (W2K/IE6/Kix4.02). I am trying to
do this withe the following code patched
together from this site. (I thank all whom
contributed).. I can not get the time to update.
What have I done wrong?

code:
$password2 = "test"
$maxtime = 15
$timeout = 0

$Ipass = HTMLInputBox("Enter Override Password:","System Shutdown","","Enter","Shutdown Now")
? "Ipass= " $Ipass
exit


;HTML Input Box:
; SYNTAX:
; HTMLInputBox("HTML Message", OPTIONAL "Window Title", OPTIONAL "Default Value",OPTIONAL "Button Text", OPTIONAL "Alt Button Text", OPTIONAL "Alt Button Return Value")
;
; PARAMETERS:
; HTML Message: The message for the Input Box. ex: What is your favorite color? Note: This can accept any HTML code, so go to town! Also Note: the <b> tag is enabled, so if you want to do custom HTML, put </b> as the first tag.
; Window Title: ( OPTIONAL ) The title of the HTML Input Box Window. If blank, defaults to "Question...".
; Default Value: ( OPTIONAL ) The default value for the box which will show when the box appears. If blank, defaults to blank.
; Button Text: ( OPTIONAL ) The text on the main button. If blank, default is "SUBMIT".
; Alt Button Text: ( OPTIONAL ) If this is specified, an alternate button will appear on the form and if clicked, the function will (by default) return "-1". This is useful as a "HELP" button, or for many other purposes.
; Alt Button Return Value: ( OPTIONAL ) If the Alt button is needed, and -1 is a potential legitimate return value for the main submit button, you can specify an alternate return value for the alternate button.
; RETURNS:
; The string in the text box, or another value if the "Alternate button" is pressed. The alternate value defaults to -1, but can be changed by specifying the "Alt Button Return Value".
;
; EXAMPLE: HTMLInputBox("Enter Override Password:","System Shutdown","","Enter","Shutdown Now")

FUNCTION HTMLInputBox($L_Prompt, OPTIONAL $L_Title, OPTIONAL $L_DefaultValue, OPTIONAL $L_ButtonText, OPTIONAL $L_AltButtonText, OPTIONAL $L_AltButtonReturnValue)

IF $L_Title = ""
$L_Title = "Question..."
ENDIF

IF $L_ButtonText = ""
$L_ButtonText = "Submit"
ENDIF

IF $L_AltButtonReturnValue = ""
$L_AltButtonReturnValue = -1
ENDIF
$L_TextColor = "FFFF00"
$L_BGColor = "000000"


$HTML = '<HTML>' +
'<BODY scroll=no TEXT=' + $L_TextColor + ' BGCOLOR=' +
$L_BGColor + '>' +
'<TITLE>' + $L_Title + '</TITLE><B>' +
$L_Prompt + '</B>' +
'<form name=MyForm>' +
'<BR>' +
'<input id=Answer name=Answer type=password class=tbox' +
' value="' + $L_DefaultValue + '" Tabindex="1"> ' +
'<input id=Submitted name=Submitted type=hidden value=0>' +
'<input id=Submit name=Submit type=button value=" ' +
$L_ButtonText + ' "' +
' onclick="MyForm.Submitted.value=1" Tabindex="2">' +
'<input id=Time name=Time ' +
' value="' + $Maxtime + '" >'

IF $L_AltButtonText <> ""
$HTML = $HTML + '<input id=AltButton name=AltButton type=button value=" ' +
$L_AltButtonText + ' "' +
' onclick="MyForm.Submitted.value=2" Tabindex="3">'
ENDIF
$Bottomtext = "This system has been started in an improper state and will conduct a Shutdown in $maxtime seconds. " +
"Shutdown is required to Re-Image this system. To override shutdown, Enter the correct password... "
$HTML = $HTML + '<BR>$Bottomtext</BR></FORM>' +
'</BODY></HTML>'

$appIE = CREATEOBJECT("InternetExplorer.Application")

;Set IE Object Properties
$appIE.top = 180
$appIE.left = 380
$appIE.height = 240
$appIE.width = 500
$appIE.addressbar = 0
$appIE.menubar = 0
$appIE.toolbar = 0
$appIE.statusbar = 0
$appIE.resizeable = 0
$appIE.navigate("about:blank")
WHILE $appIE.busy <> 0 AND @ERROR = 0
LOOP

;Write the HTML code to the document
$appIE.document.write($HTML)

WHILE $appIE.busy <> 0 AND @ERROR = 0
LOOP

;Make IE visible and set focus
$appIE.visible = 1
$= SETFOCUS("about:blank - Microsoft Internet Explorer")
$appIE.document.GetElementById("Answer").focus

DIM $L_LastBoxValue,$L_LastBoxValueCache
WHILE $appIE.document.GetElementById("Submitted").value = 0 and $timeout < $maxtime
IF $appIE.document.GetElementById("Submit").value = " " + $L_ButtonText + " "
IF $appIE.document.GetElementById("Answer").value <> ""
$L_LastBoxValue = $appIE.document.GetElementById("Answer").value
IF $L_LastBoxValue <> ""
$L_LastBoxValueCache = $L_LastBoxValue
ENDIF
ENDIF
ENDIF
sleep(1)
$timeout=$timeout+1
$appIE.document.Time.interhtml = $maxtime-$timeout
LOOP

IF $appIE.document.GetElementById("Submitted").value = 2
$HTMLInputBox = $L_AltButtonReturnValue
ELSE
$HTMLInputBox = $L_LastBoxValueCache
ENDIF

$appIE.QUIT
$appIE = ""
ENDFUNCTION





[ 09 June 2002, 23:33: Message edited by: Dana Eddy ]