Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need assistance with Javascript

    I had this is the wrong forum, reposting here:

    I'm very new to javascript, so I hope someone here will know the answer to this.

    I'm trying to create a mock-commercial site for a school project and I'm getting stuck on one point. I have a page with selection boxes which 'get' to a javascript to create a results page. On the result page it echos back the answers from the selection box and has the standard textboxes for the user to then enter name/address/creditcard information. That form forwards to a final page with displays the name/address stuff perfectly, but it just says undefined for the information that was passed from the first page to the second page.

    Is there a way to redeclare those values and forward them on to the last page with the new information?

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Location
    Maryland
    Posts
    468
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You use window.opener. I personally could never get it to work with variables but heres an example.
    Code:
    var tTitle = window.opener.document.getElementById('tTitle').value

  • #3
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, I think I see what you are saying. The first page looks like this:
    Code:
    <form name="build" action="build_result.html" method="get" valign="top">
    					<img src="images/duramax.jpg" width="100" align="right" />
    					<br /><br /><br />
    					Choose your motherboard:
    					<select name="mobo" size="1">
    						<option value="Abit AA8-DuraMAX">Abit AA8-DuraMAX - $159.95</option>
    						<option value="Asus P5AD2">Asus P5AD2 - $135.64</option>
    						<option value="Gigabyte GA-8ANXP-D">Gigabyte GA-8ANXP-D - $146.99</option>
    					</select><br /><br /><br /><br /><br /><br /><br /><br />
    					
    					<img src="images/athlon64.jpg" width="120" align="left" />
    					<br /><br /><br />
    					Choose your processor:
    					<select name="cpu" size="1">
    						<option value="AMD Athlon 64 3400">AMD Athlon 64 3400 - $399.99</option>
    						<option value="Intel P4 3.2Ghz">Intel P4 3.2Ghz - $375.45</option>
    					</select><br /><br /><br /><br /><br /><br /><br /><br />
    			
    					<img src="images/atiradeon.jpg" width="100" align="right" />
    					<br /><br /><br />
    					Choose your video card:
    					<select name="video" size="1">
    						<option value="ATI X800 256MB">ATI X800 256MB - $399.99</option>
    						<option value="Nvidia Geforce FX 256MB">Nvidia Geforce FX 256MB - $450.95</option>
    					</select><br /><br /><br /><br /><br /><br /><br /><br />
    					
    					<img src="images/creativeaudigy2.jpg" width="120" align="left" />
    					<br /><br />
    					Choose your sound card:
    					<select name="sound" size="1">
    						<option value="Creative Labs Audigy 2">Creative Labs Audigy 2 - $65.00</option>
    						<option value="Turtle Beach Santa Cruz">Turtle Beach Santa Cruz - $50.00</option>
    					</select><br /><br /><br /><br /><br /><br /><br /><br />
    					
    					<img src="images/lianliv1000.jpg" width="100" align="right" />
    					<br /><br /><br />
    					Choose your case:
    					<select name="case" size="1">
    						<option value="Lian Li V1000">Lian Li V1000 - $129.99</option>
    						<option value="Antec Super LANBoy">Antec Super LANBoy - $75.99</option>
    					</select><br /><br /><br /><br /><br /><br /><br /><br />
    					<br /><br /><br /><br /><br /><br />
    					
    					<input type="submit" value="Submit this Build" />
    					<input type="reset" value="Start Over" />
    				</form>
    And the script places that perfectly into the second page, which is running this:
    Code:
    <script src="CSJSRequestObject.js" type="text/javascript"></script>
    <link rel="stylesheet" href="ccc.css" type="text/css" />
    </head>
    <body>
    
    <h3>This is the build you requested:</h3>
    Motherboard:
    	<script type="text/javascript">document.write(Request.QueryString("mobo"))</script><br /><br />
    Processor:
    	<script type="text/javascript">document.write(Request.QueryString("cpu"))</script><br /><br />
    Video Card:
    	<script type="text/javascript">document.write(Request.QueryString("video"))</script><br /><br />
    Sound Card:
    	<script type="text/javascript">document.write(Request.QueryString("sound"))</script><br /><br />
    Case:
    	<script type="text/javascript">document.write(Request.QueryString("case"))</script><br /><br />	
    
    <form name="reg" action="ordersub_final.html" method="get">
    <table>
    	<tr>
    		<td align="right">First Name</td>
    		<td><input type="text" size="40" name="fname" maxlength="20"/></td>
    	</tr>
    	<tr>
    		<td align="right">Last Name</td>
    		<td><Input type="text" size="40" name="lname" maxlength="20"/></td>
    	</tr>
    	<tr>
    		<td align="right">Address</td>
    		<td><Input type="text" size="70" name="address" maxlength="50"/></td>
    	</tr>
    	<tr>
    		<td align="right">City</td>
    		<td><Input type="text" size="50" name="city" maxlength="30"/></td>
    	</tr>
    	<tr>
    		<td align="right">State</td>
    		<td><input type="text" size="5" name="state" maxlength="2"/></td>
    	</tr>
    	<tr>
    		<td align="right">ZipCode</td>
    		<td><input type="text" size="10" name="zip" maxlength="5"/></td>
    	</tr>
    </table>
    <br /><br />
    Credit Card Type:<br /><br />
    <input type="radio" value="1" name="card_type" />
    American Express<br />
    <input type="radio" value="2" name="card_type" />
    Mastercard<br />
    <input type="radio" value="3" name="card_type" checked="checked"/>
    Visa<br />
    
    Credit Card Number: <input type="text" name="ccnumber" /><br /><br />
    Expiration Date: 
    <select name="exp_month">
    	<option value="1">January</option>
    	<option value="2">February</option>
    	<option value="3" selected>March</option>
    	<option value="4">April</option>
    	<option value="5">May</option>
    	<option value="6">June</option>
    	<option value="7">July</option>
    	<option value="8">August</option>
    	<option value="9">September</option>
    	<option value="10">October</option>
    	<option value="11">November</option>
    	<option value="12">December</option>
    </select>
    <select name="exp_year">
    <option value="2004">2001</option>
    <option value="2005">2002</option>
    <option value="2006">2003</option>
    <option value="2007">2004</option>
    <option value="2008">2008</option>
    </select><br /><br /><br />
    <input type="submit" value="Submit this Build" />
    <input type="reset" value="Start Over" />
    </form>
    However I can't forward the original information. From what you are saying, I need to change the '<script type="text/javascript">document.write(Request.QueryString("mobo"))</script>' on the second page to 'var mobo = window.opener.document.getElementById('mobo').value' ?

    Sorry this is so sloppy, I'm pretty new to xhtml too


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •