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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnChange Event 1

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
Hi,

I am trying to use a OnChange event to do some processing, when user enters values in a text box. The output is returned to the test boxes.
Is it possible in Vb Script?

Can I use both VBScript and JavaScript in the same page?

Rosh
 
Yes you can use both java and VBscript on the same page...
Now for the tougher question.

What you want to do is take data entered into one text box and then Manipulate it and display it into another text box. This can be done with either VBscript or JavaScript. It is done with a client side script Here is a code that will take a Full Name and seperate it into first name and last name text fields:

Code:
<html>

<head>
<title>Name Splitter</title>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;>
<meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;>
</head>

<body>

<script language=vbscript>
dim strfirstname
dim strlastname

sub Splitter(mydata)
strfirstname=left(mydata,(instr(mydata,&quot; &quot;)-1))
strlastname=right(mydata,(len(mydata)-instr(mydata,&quot; &quot;)))

document.myform.firstname.value=strfirstname
document.myform.lastname.value=strlastname
end sub

</script>


<form name=&quot;myform&quot;>
	<input type=&quot;text&quot; name=&quot;fullname&quot; size=&quot;20&quot; onchange=&quot;splitter(document.myform.fullname.value)&quot;>
	<input type=&quot;text&quot; name=&quot;firstname&quot; size=&quot;20&quot;> <input type=&quot;text&quot; name=&quot;lastname&quot; size=&quot;20&quot;>
</form>

</body>

</html>
hope this helps

Tal McMahon

 
That was great...
Thank you very much...

Could u please tell me about any books on VBScript and JavaScript

Rosh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top