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

Creating a personalized javascript-enabled page based on form input

Status
Not open for further replies.

wuz

Programmer
Jul 10, 2000
18
0
0
US
I'm trying to create a personalized page, but I can't seem to get the new page to work.<br><br>What I want to do is to create a form with a name field that people can fill out and submit.&nbsp;&nbsp;When they submit the form, I would like another HTML page to appear, with the name embedded in the page.&nbsp;&nbsp;I don't need to be able to store the information at all; it just needs to display on the next page.<br><br>So far, I have been able to create a form that, when submitted, creates the page in a javascript window.&nbsp;&nbsp;But I want to have the page created in an HTML page so that it can be printed.&nbsp;&nbsp;If I try to send the name field to the next page, the field show as undefined.<br><br>Any ideas?&nbsp;&nbsp;This seems like it should be pretty basic.&nbsp;&nbsp;I'm very new to Javascript, so maybe I'm missing something here.<br><br>Thanks to all in advance for your help.<br><br>P.S.: Here's my current code -&gt;<br><br>Form.htm:<br>&lt;HTML&gt;<br>&lt;HEAD&gt;<br>&lt;TITLE&gt;Form&lt;/TITLE&gt;<br>&lt;/head&gt;<br>&lt;BODY&gt;<br>&lt;FORM NAME=&quot;InfoForm&quot; action=&quot;results.htm&quot;&gt;<br>Name:&lt;INPUT TYPE=&quot;text&quot; NAME=&quot;Name&quot; VALUE=&quot;&quot; SIZE=50&gt;<br>&lt;INPUT TYPE=&quot;submit&quot;&gt;&lt;BR&gt;<br>&lt;/FORM&gt;<br>&lt;/BODY&gt;<br>&lt;/HTML&gt;<br><br>Results.htm:<br>&lt;HTML&gt;<br>&lt;HEAD&gt;<br>&lt;TITLE&gt;Results&lt;/TITLE&gt;<br>&lt;SCRIPT LANGUAGE=&quot;JavaScript&quot;&gt;<br> var Name = document.URL.Name;<br>&lt;/SCRIPT&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>&lt;SCRIPT LANGUAGE=&quot;JavaScript&quot;&gt;<br> document.write (&quot;Hello, &quot; + Name);<br>&lt;/SCRIPT&gt;<br>&lt;/BODY&gt;<br>&lt;/HTML&gt;
 
I could be wrong, but Im pretty sure the syntax you are using to access that variable is wrong. You cannot access the variable you've submitted that simply. You have to retrieve the search string, and parse through it. window.location.search returns the red string below:<br><br>mypage.htm<font color=red>?name=futurekiss&age=12</font><br><br>You then use splits and stuff to parse out the variables.<br>I have some code that does this if youd like to see it.<br><br><A HREF="mailto:jared@aauser.com">jared@aauser.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top