Form data used to open new window

liunx

Guest
This is probably a really simple thing...but I've not worked with forms very much at all.<br />
<br />
What I want to do is have a user enter a 6 character value (ASMITH) into a form and when they click the submit button, it takes that data they entered and appends .html to the end of it and then opens the new ASMITH.html page in a new window.<br />
<br />
Any help that can be provided would be very, very appreciated! <br />
<br />
Thanks guys!<br />
<br />
Tom<!--content-->get value from the text field<br />
suppose form name is <br />
"form1" and text field name is "t1"<br />
this is how you get the value from the tet feild and create a page name and open it in curent window<br />
<br />
var value = document.form1.t1.value;<br />
window.location.href=http://www.webdeveloper.com/forum/archive/index.php/value+".html";<!--content-->Thanks Khalid! I appreciate your help!<br />
<br />
Tom<!--content-->I'm having issues with the code below. Keep in mind that I am very new to forms...so please keep the laughter to a dull roar. :-)<br />
<br />
What I want to do is take the value from the form and use it to open a new window with ".html" added on to whatever the user entered in the form. Thanks in advance for any help you can offer.<br />
<br />
Tom<br />
<br />
<HTML><br />
<HEAD><br />
<TITLE>Client Inquiry</TITLE><br />
<script><br />
var docvalue = document.form1.t1.value;<br />
</script><br />
</HEAD><br />
<BODY><br />
<FORM NAME="form1" METHOD="get"><br />
Enter Query Text: <INPUT TYPE="text" NAME="t1" size="18" maxlength="18"><br />
<input type="submit" value="Get Info" class="button" onclick="window.location.href=http://www.webdeveloper.com/forum/archive/index.php/docvalue+".html";"><br />
</FORM><br />
</body><br />
</html><!--content-->Okay, I've tried to simplify this as best I can...see below.<br />
<br />
Can anyone tell me what's wrong...or how I can accomplish this? Thanks guys.<br />
<br />
Happy holidays.<br />
<br />
Tom<br />
<br />
<HTML><br />
<HEAD><br />
<TITLE>Test</TITLE><br />
<script><br />
var docvalue="/"+document.form1.t1.value+".html";<br />
</script><br />
</HEAD><br />
<BODY><br />
<FORM NAME="form1"><br />
Enter Query Text: <INPUT TYPE="text" NAME="t1" size="18" maxlength="18"><br />
<input type="button" value="Get Info" onClick="window.open('docvalue','','')"><br />
</FORM><br />
</body><br />
</html><!--content-->The code is working okay now...see below.<br />
<br />
<HTML><br />
<HEAD><br />
<TITLE>Test</TITLE><br />
<script language="JavaScript"><br />
function openWin()<br />
{<br />
var docvalue=document.form1.t1.value+".html";<br />
window.open(docvalue,'','');<br />
}<br />
</script><br />
</HEAD><br />
<BODY><br />
<FORM NAME="form1"><br />
Enter Query Text: <INPUT TYPE="text" NAME="t1" size="18" maxlength="18"><br />
<input type="button" value="Get Info" onClick="openWin();"><br />
</FORM><br />
</body><br />
</html><!--content-->It's probably better to do<br />
<br />
<HTML> <br />
<HEAD> <br />
<TITLE>Test</TITLE> <br />
<script language="JavaScript"> <br />
function openWin() <br />
{ <br />
window.open(document.form1.t1.value + ".html",'',''); <br />
} <br />
</script> <br />
</HEAD> <br />
<BODY> <br />
<FORM NAME="form1" onsubmit="openWin()"> <br />
Enter Query Text: <INPUT TYPE="text" NAME="t1" size="18" maxlength="18"> <br />
<input type=submit value="Get Info"> <br />
</FORM> <br />
</body> <br />
</html><!--content-->
 
Back
Top