zytex Posted June 27, 2006 Share Posted June 27, 2006 hi i have this code<form action onSubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1"> <p dir="ltr" style="text-align: center"> <font size="2" color="#000000"><strong><font color="#333333" size="3" face="Verdana, Arial, Helvetica, sans-serif"><span class=dirtitle> <script type="text/javascript">function cp_go( the_form ) {if ( !the_form.channel.value ) { return; }location = 'name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value;} </script> </span></font></strong><br> <br> Search User Profiles:<br> </font><font size="1" face="Verdana"> <span style="background-color: #FFFFFF"><font color="#000000"> <input name="channel" type="text" class="input_field" style="height: 20px; width: 280px" size="20" maxlength="15"> (Enter the username of the chatter here)</font></span></font></p> <p style="text-align: center"> <span style="background-color: #FFFFFF"> <font color="#008000" size="2" face="Verdana"> <input name="cplogin" class="login_but" type="button" onClick="cp_go(this.form)" value="Search For Profile" width="49" height="20"> <input name="rform" class="login_but" type="reset" onClick="cp_go(this.form)" value="Reset Form" width="49" height="20"></form> </font></span>and right now the profile gets open in the same window, i would like it to be opened in a new window. is this possible?thanks, Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted June 27, 2006 Share Posted June 27, 2006 you could add target="_blank" to your <form> tag. That should do it. Quote Link to comment Share on other sites More sharing options...
zytex Posted June 28, 2006 Author Share Posted June 28, 2006 thanks for the reply would u be able to show me exactly were it goes im now to java script Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted June 28, 2006 Share Posted June 28, 2006 it's not javascript.<form action [b]target="_blank"[/b] onSubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1"> Quote Link to comment Share on other sites More sharing options...
zytex Posted June 28, 2006 Author Share Posted June 28, 2006 [!--quoteo(post=388973:date=Jun 28 2006, 03:38 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Jun 28 2006, 03:38 PM) [snapback]388973[/snapback][/div][div class=\'quotemain\'][!--quotec--]it's not javascript.<form action [b]target="_blank"[/b] onSubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">[/quote]yeh i did that before thats why i asked were to put it because it dosn't work, it still opens in the same window Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted June 29, 2006 Share Posted June 29, 2006 okay, looking at the javascript, your culprate might be here:[code]location = 'name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value;}[/code]the "location" part emulates a header location redirect. redirects will not open new windows. you could replace that line of code with [code]window.open('name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value','_blank');[/code] and it should open a new window instead of redirecting. HOWEVER, you might have problems with popup blockers.Keeping the target="_blank" in the <form> header, You could also try changing that line out with this:[code]document.forms[0].action = 'name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value; return = true;}[/code]return = true should tell the form to submit to the new location.if it gives you trouble, try adding a question mark before the name= part:[code]document.forms[0].action = '?name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value; [/code] Quote Link to comment Share on other sites More sharing options...
zytex Posted June 29, 2006 Author Share Posted June 29, 2006 [!--quoteo(post=389050:date=Jun 28 2006, 08:12 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Jun 28 2006, 08:12 PM) [snapback]389050[/snapback][/div][div class=\'quotemain\'][!--quotec--]okay, looking at the javascript, your culprate might be here:[code]location = 'name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value;}[/code]the "location" part emulates a header location redirect. redirects will not open new windows. you could replace that line of code with [code]window.open('name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value','_blank');[/code] and it should open a new window instead of redirecting. HOWEVER, you might have problems with popup blockers.Keeping the target="_blank" in the <form> header, You could also try changing that line out with this:[code]document.forms[0].action = 'name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value; return = true;}[/code]return = true should tell the form to submit to the new location.if it gives you trouble, try adding a question mark before the name= part:[code]document.forms[0].action = '?name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value; [/code][/quote]thanks for all your help! but do you know why i might be getting error on page when i use[code]<script type="text/javascript">function cp_go( the_form ) {if ( !the_form.channel.value ) { return; }document.forms[0].action = 'name=Forums&file=profile&mode=viewprofile&u=+'the_form.channel.value;}return = true;}</script>[/code]actually every way you stated above gave me error on page. Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted June 29, 2006 Share Posted June 29, 2006 you could try swapping out forms[0] with the_form or getElementById('the_form') Quote Link to comment Share on other sites More sharing options...
zytex Posted June 29, 2006 Author Share Posted June 29, 2006 no dice, do you know if there is a way i can preform the same function but without using javascript since its causing me so many problems Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted July 4, 2006 Share Posted July 4, 2006 try this:change the "action" to the name of the file.[code]<form method="get" action="post_to_location.html"><input type="hidden" name="name" value="Forums"><input type="hidden" name="file" value="profile"><input type="hidden" name="mode" value="viewprofile"> <p dir="ltr" style="text-align: center"> <font size="2" color="#000000"><strong><font color="#333333" size="3" face="Verdana, Arial, Helvetica, sans-serif"><span class=dirtitle> </span></font></strong> Search User Profiles: </font><font size="1" face="Verdana"> <span style="background-color: #FFFFFF"><font color="#000000"> <input name="channel" type="text" class="input_field" style="height: 20px; width: 280px" size="20" maxlength="15"> (Enter the username of the chatter here)</font></span></font></p> <p style="text-align: center"> <span style="background-color: #FFFFFF"> <font color="#008000" size="2" face="Verdana"> <input name="cplogin" class="login_but" type="button" onClick="cp_go(this.form)" value="Search For Profile" width="49" height="20"> <input name="rform" class="login_but" type="reset" onClick="cp_go(this.form)" value="Reset Form" width="49" height="20"></form> </font></span>[/code]and cross your fingers. It might be using get and post (which would be tricky without using PHP). Quote Link to comment Share on other sites More sharing options...
zytex Posted July 6, 2006 Author Share Posted July 6, 2006 i still get errors, i never thought this fuction would be so difficult im willing to try any alternative! Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted July 6, 2006 Share Posted July 6, 2006 I forgot to remove the javascript from the submit and reset buttons. see if this works.[code]<form method="get" action="post_to_location.html"><input type="hidden" name="name" value="Forums"><input type="hidden" name="file" value="profile"><input type="hidden" name="mode" value="viewprofile"> <p dir="ltr" style="text-align: center"> <font size="2" color="#000000"><strong><font color="#333333" size="3" face="Verdana, Arial, Helvetica, sans-serif"><span class=dirtitle> </span></font></strong> Search User Profiles: </font><font size="1" face="Verdana"> <span style="background-color: #FFFFFF"><font color="#000000"> <input name="channel" type="text" class="input_field" style="height: 20px; width: 280px" size="20" maxlength="15"> (Enter the username of the chatter here)</font></span></font></p> <p style="text-align: center"> <span style="background-color: #FFFFFF"> <font color="#008000" size="2" face="Verdana"> <input name="cplogin" class="login_but" type="submit" value="Search For Profile" width="49" height="20"> <input name="rform" class="login_but" type="reset" value="Reset Form" width="49" height="20"></form></font></span>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.