Jump to content


Photo

Open link in new window


  • Please log in to reply
11 replies to this topic

#1 zytex

zytex
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 27 June 2006 - 03:16 AM

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,

#2 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 27 June 2006 - 11:43 PM

you could add target="_blank" to your <form> tag. That should do it.

#3 zytex

zytex
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 28 June 2006 - 07:30 PM

thanks for the reply would u be able to show me exactly were it goes im now to java script

#4 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 28 June 2006 - 07:38 PM

it's not javascript.

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

#5 zytex

zytex
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 28 June 2006 - 11:58 PM

[!--quoteo(post=388973:date=Jun 28 2006, 03:38 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Jun 28 2006, 03:38 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
it's not javascript.

<form action target="_blank" 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

#6 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 29 June 2006 - 12:12 AM

okay, looking at the javascript, your culprate might be here:

location = 'name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value;}

the "location" part emulates a header location redirect. redirects will not open new windows. you could replace that line of code with
window.open('name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value','_blank');
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:
document.forms[0].action = 'name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value; 
return = true;
}
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:
document.forms[0].action = '?name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value;


#7 zytex

zytex
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 29 June 2006 - 01:57 AM

[!--quoteo(post=389050:date=Jun 28 2006, 08:12 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Jun 28 2006, 08:12 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
okay, looking at the javascript, your culprate might be here:

location = 'name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value;}

the "location" part emulates a header location redirect. redirects will not open new windows. you could replace that line of code with
window.open('name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value','_blank');
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:
document.forms[0].action = 'name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value; 
return = true;
}
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:
document.forms[0].action = '?name=Forums&file=profile&mode=viewprofile&u='+the_form.channel.value;
[/quote]

thanks for all your help! but do you know why i might be getting error on page when i use

<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>

actually every way you stated above gave me error on page.

#8 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 29 June 2006 - 02:12 AM

you could try swapping out forms[0] with the_form or getElementById('the_form')

#9 zytex

zytex
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 29 June 2006 - 04:32 AM

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

#10 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 04 July 2006 - 05:20 PM

try this:

change the "action" to the name of the file.
<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>

and cross your fingers. It might be using get and post (which would be tricky without using PHP).

#11 zytex

zytex
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 06 July 2006 - 12:46 AM

i still get errors, i never thought this fuction would be so difficult im willing to try any alternative!

#12 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 06 July 2006 - 01:08 AM

I forgot to remove the javascript from the submit and reset buttons. see if this works.

<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>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users