• 0

VBScript Concatenating Two Strings + Display Result


Scotch Tape

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!

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

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

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Rich Woods
      Microsoft will disable VBScript in IE11 on August 13 for Windows 7, 8, and 8.1
      by Rich Woods

      Back in 2017, Microsoft announced that it would begin phasing out VBScript, a legacy scripting language that goes back to 1996. Back in those days, Microsoft had its own scripting languages, like JScript, an alternative to JavaScript. While JScript was based on Microsoft's own proprietary version of Java, VBScript, as the name suggests, was based on pre-.Net Visual Basic.

      Now, the time has come for VBScript. Beginning with the cumulative updates that will arrive this month on Patch Tuesday, or August 13, VBScript will be disabled by default in Internet Explorer 11 on Windows 7, Windows 8, and Windows 8.1. The feature was already turned off on the July 9 cumulative updates for Windows 10.

      In a blog post, the Redmond firm also noted that there will still be settings to enable VBScript if you need it via the Registry, Group Policy, and Restricted Sites. After the updates, it will be disabled by default for Internet and Untrusted zones.

      Obviously, there are some businesses that will still rely on the legacy scripting language, but this will begin the push to move on.

    • By Rich Woods
      Today's Windows 10 Insider Preview build disables VBScript in Internet Explorer by default
      by Rich Woods

      Earlier today, Microsoft released Windows 10 for PCs build 16237 to the Fast ring, adding a number of new features and changes. In a separate announcement, the company said that in this build, VBScript will be disabled in Internet Explorer 11 (IE11) Internet and Restricted Sites Zones by default.

      VBScript is something that Microsoft is gradually phasing out of its browsers, as it's not part of Edge at all, and it's an officially deprecated scripting language in IE11. The ability to block VBScript first showed up in the Creators Update and the April cumulative security update for Internet Explorer, but this is the first time that that option is turned on by default, and if you're not an Insider, you'll see this change in the Fall Creators Update.

      As with the change that was made in April, users of previous versions of Windows will still see this, but it will come in the form a cumulative security update. Of course, there will still be methods for enabling VBScript, as IE11 is still included in Windows 10 for the purpose of backward compatibility.

      Microsoft suggests that if you have any feedback on this, head over to the Feedback Hub.

    • By Gareth Chamberlain
      Good Morning All 
      This is my first post, so please be gentle  
      I am looking to network 8 printers but i want them to be mapped to a username e.g 
      'customer services script Dim obj Set obj = CreateObject("Wscript.Network") WScript.Echo obj.UserName = "gbcg01,gbxx01,gbxx02" Then objWshNetwork.AddWindowsPrinterConnection "\\Myserver\Printer 'run my next script for the next department objShell.Run "Warehouse_script.vbs" We cannot use GPO as we are a subsidiary and the main IT are useless
      any chance of a hand? 
    • By Daedroth
      Hello, I have an essential hotfix that has been deployed across our network, however it has not been installed on all the machines, and want to check which machines will need the hotfix.
      Using VBScript, is there a way that a script that runs at startup that checks whether a specific KB is NOT installed and write the result as a file into a directory?
      At the moment I have this:
      On Error Resume Next   strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering",,48) Set objFSO=CreateObject("Scripting.FileSystemObject") Set wshNetwork = WScript.CreateObject( "WScript.Network" ) strComputerName = wshNetwork.ComputerName     For Each objItem in colItems   If objItem.HotfixID = "KB2590550" then   outFile="\\F30-CHI\D$\VBTest\" & strComputerName Set objFile = objFSO.CreateTextFile(outFile,True) objFile.Close   End If   Next This works perfectly for creating a file if the Hofix IS installed. However I want it to create a file if it is NOT installed.
      Is this possible?
    • By Daedroth
      Hi. I'm not too brilliant with VBScript, so please bear with me. I'm trying to create a script to search for xyz value in the registry and delete it from a target machine.
      I'd like the process to be:
      Box to input xyz
      Box to input target machine name
      Scan target registry and delete the value, keep scanning until all are deleted.
      Report how many deleted or report if none found.
      Is this possible?
      So far I have:

      Set WshShell = WScript.CreateObject("WScript.Shell")
      Set DelReg = GetObject ("WinMgmts:{impersonationLevel=impersonate}!//./root/default:StdRegProv")

      'Constants for WMI StdRegProv
      Const HKCU = &H80000001
      Const HKLM = &H80000002
      Const HK_USERS = &H80000003

      'On Error Resume Next

      sStartKeyPath = "" 'Sets the search to start from the root of the registry

      Do while regkey = ""
      regkey = InputBox("What would you like to search the registry for?")
      if regkey = "" then
      msgbox "Please enter search criteria."
      End if

      DelReg.DeleteValue regkey[/CODE]
      At the moment I can't even get it to search and delete a key from my own machine.