Click to See Complete Forum and Search --> : passing variables to a js function


aleks1429
12-19-2006, 12:29 PM
i am trying to pass variables to a Reload function on my ASP page.

the function goes something like this:
reload(form, strUserName,strPwd)


vbs that is calling the function is as follows:
Response.Write "<form method=post name=myFrame action=Main.asp target=Nav><select name=CodeName onchange='reload(this.form,strUserName,strPwd)'><option value=''>Select Property</option>"

Once, i try to render the page, I am getting an error that strUserName and strPwd are not defined.

How can this be fixed?

Thanks

TheBearMay
12-19-2006, 12:50 PM
Try:
Response.Write "<form method=post name=myFrame action=Main.asp target=Nav><select name=CodeName onchange='reload(this.form,"+strUserName+","+strPwd+")'><option value=''>Select Property</option>"

russell
12-19-2006, 01:04 PM
small modification to the "old guy's" script -- put quotes around the arguments

Response.Write "<form method=post name=myFrame action=Main.asp target=Nav><select name=CodeName onchange='reload(this.form,'"+strUserName+"','"+strPwd+"')'><option value=''>Select Property</option>"also, you'll need to escape any quotes in the arguments, for example if strUserName = "O'Brien"

aleks1429
12-19-2006, 01:30 PM
thank you guys, it worked fine