View Full Version : passing parameters to an onload event

05-11-2010, 04:05 PM
This is the crash example.
<body onLoad="myFunction(v1,v2,v3,v4);">
v1 is an integer, v2 a string, v3 date, v4 hour
Those variables are defined on <head> section so:
Dim v1, v2, v3, v4
v1 = Request("variable1")
v2 = Request("variable2")
if v2 > 0 then
v3 = fFormat(v3, Request("sort")) ' a function imported form an .inc file
v3 = AnotherFunction() 'a function imported form an .inc file
end if
v4 = Request("variable3")
and myFunction is defined on script section! before <html> tag

Sub myFunction(myInt, myString, myDate, myHour)
Dim myUrl
myUrl = "print.asp?id=" &myInt&"&txt="&myString&"&date=" & myDate & "&time=" & myTime & "&print=visible&cancel=hidden"
MsgBox myUrl, vbExclamation, "Ojo al piojo" <!-- for testing -->
window.open myUrl, "_blank", "fullscreen=yes,scrollbars=yes,location=no"
End Sub

What is bad?
Why crashes?
Help! :cool: