how do you get query variables into a text field??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acehigh1983
    New Member
    • Oct 2007
    • 3

    how do you get query variables into a text field??

    hi i have been writting some HTML code and i have a web page that sends a username and password via a form post (can also use get) to another HTML page. I need to get the variables out of the query string and into 2 textboxes, these will then be passed into an IFrame containing a webpage from a third party.

    here is the query string i get in the navigation bar using the get method.

    http://localhost/black%20box/test.html?Uid=t esting&PWD=TEST 56789&Submit=Lo gon+...

    here is the code for the HTML page containing the text boxes.

    Code:
    <html>
    	<HEAD>
    		<script language="JavaScript" id="log_in" type="text/javascript">
    			t = null;
    			var str = "";
    			var fullURL = "";
    			var xxx = "";
    			function getInfo()
    			{
    				
    			}
    			function post_info()
    			{
    				document.postInfo.submit();
    			}
    			function post_info2()
    			{
    				document.postInfo2.submit();
    			}
    			function change_page();
    			{
    				str += "http://62.231.143.98/guardnet/Online.ASP?WCI=Login&WCE=Login&WCU="
    				window.location = str;
    			}
    		</script>
    	</HEAD>
    	<BODY onload="post_info()">
    		<iframe name="ourSite" src="http://localhost/black%20box/monlog.shtml"></iframe>
    		<iframe name="theirSite" src="http://62.231.143.98/guardnet/Online.asp?WCI=Welcome&amp;WCI=Home"></iframe>
    		<!--<frameset cols="0%,100%">
    	<frame name="theirSite" src="http://62.231.143.98/guardnet/Online.ASP?WCI=Login&WCE=Login&WCU=">
    	<frame name="ourSite" src="http://localhost/black%20box/monlog.shtml">
    </frameset>-->
    		<form method="post" target="theirSite" name="postInfo" ID="Form1">
    			<div align="center" runat="server">
    				<table ID="Table1">
    					<tr>
    						<td>
    							<input type="hidden" name="Uid" ID="Uid"><br>
    							<input type="hidden" name="PWD" ID="PWD">
    						</td>
    					</tr>
    				</table>
    			</div>
    		</form>
    	</BODY>
    </html>
    how do i get the information - testing and test56789 out of the query string and into the 2 hidden boxes?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    Normally, you'd use server-side code for this and especially when usernames and passwords are involved.

    Anyway, you could use the String object methods to parse the location.search property.

    Comment

    Working...