Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing values to functions 1

Status
Not open for further replies.

supremus

Programmer
Apr 20, 2001
3
0
0
UY
G'day,
I am studing at college and need help. I am having problems passing a value from a text input box to a function.
Also, in some programs I am experimenting with the function prints results in a new window and in others, in the current window - not too sure how I am mucking this up.

Peter
****************************************

<html>
<head><title>Angus Bookstore Autumn Sale</title>

<script language=&quot;vbscript&quot;>
function DoIt(Junk)
document.write(Junk)
document.write(form1.input1.value)
end function
</script>
</head>

<body bgcolor = &quot;#ffcc99&quot; text = &quot;#800000&quot;>

<form name=&quot;form1&quot;>
<input type=&quot;text&quot; name=&quot;input1&quot; onChange=doit(66)>
</form>
<script>doit(33)</script>
</body>
</html>
 
supremus,

I would use Javascript as client side VBScript is not supported by Netscape. Try the following:

<html>
<head><title>Angus Bookstore Autumn Sale</title>

<script language=&quot;JavaScript&quot;>
function DoIt(Junk) {

var temp=document.form1.input1.value
document.write(Junk)
document.write(temp)

}
</script>
</head>

<body bgcolor = &quot;#ffcc99&quot; text = &quot;#800000&quot;>

<form name=&quot;form1&quot;>
<input type=&quot;text&quot; name=&quot;input1&quot; onChange=&quot;doit(66)&quot;>
</form>
</body>
</html>

If you have to use VBScript, the main problem is that you need quotes around the doit(66) when you call it using the onChange event.

Hope this helps. Mise Le Meas,

Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top