Jump to content
Updating IPB tonight Read more... ×

Archived

This topic is now archived and is closed to further replies.

zytex

Open link in new window

Recommended Posts

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,

Share this post


Link to post
Share on other sites
thanks for the reply would u be able to show me exactly were it goes im now to java script

Share this post


Link to post
Share on other sites
it's not javascript.

<form action [b]target="_blank"[/b] onSubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">

Share this post


Link to post
Share on other sites
[!--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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
i still get errors, i never thought this fuction would be so difficult im willing to try any alternative!

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.