• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

VBScript Concatenating Two Strings + Display Result

Question

Scotch Tape    0

Hello I've just started to learn VBScript for one of my classes and am hoping someone here may be able to help me out. I am trying to write a script that will concatenate two strings. The user will type two words, each into a different text box and then click to submit. The script will then join the first and second word together and output the result into a third text box.

My trouble is in displaying the result after concatenating the two words. I am currently unsuccessfully using document.write but really I want to have it display in the third text box.

Any help and advice is appreciated!


<!DOCTYPE HTML>
<HEAD>
<TITLE> Assignment 10 - VBScript </TITLE>
<SCRIPT TYPE="TEXT/VBScript">
<!--
Dim word1, word2, result
Function concatenateWord()
result = word1 & word2
document.write(result)
End Function
-->
</SCRIPT>
</HEAD>
<BODY>
<h3> Please Enter a Minimum of 3 Characters </h3>
<FORM name="myForm" onSubmit="return concatenateWord()">
<TABLE border="0" width="300">
<tr>
<td width="100"> First word: </td>
<td width="200"> <input type="text" id="word1"></td>
</tr>

<tr>
<td width="100"> Second word: </td>
<td width="200"> <input type="text" id="word2"></td>
</tr>
<tr>
<td width="100"> Result: </td>
<td width="200"> <input type="text" id="result"></td>
</tr>
</TABLE>
<TABLE border="0" width="300">
<tr>
<td width="10" align="center">
<INPUT TYPE="SUBMIT" VALUE="Concatenate"></td>
</tr>
</TABLE>
</FORM>
</BODY>
</HTML>
[/CODE]

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.