HELP WITH This Javascript.

finerpleasures

Regular Member
Joined
Feb 17, 2009
Messages
337
Reaction score
100
Hey guys, i have no knowledge of javascript but i desperately need this script to open in the same window. So far, it keep coming up as a pop up of somesort please help me out.

Code:
<div align="center"><center>
<form name="StatPac_Survey_Software" action="javascript:open_survey_software_results()" method="POST">
<input type="hidden" name="poll_id" value="12030711501177">
<input type="hidden" name="ip_check" value="0">
<input type="hidden" name="cookie_check" value="1">
<input type="hidden" name="time_out" value="5/5/2013">
<input type="hidden" name="view_results_before" value="0">
<input type="hidden" name="view_results_after" value="1">
<input type="hidden" name="view_mode" value="0">
<input type="hidden" name="sorted" value="1">
<input type="hidden" name="graph" value="1">
<input type="hidden" name="graph_width" value="200">
<input type="hidden" name="graph_bgColor" value="#DDDDDD">
<input type="hidden" name="graph_color" value="#000000">
<input type="hidden" name="font_name" value="Arial">
<input type="hidden" name="font_size" value="2">
<input type="hidden" name="title_bar" value="Survey Results">
<input type="hidden" name="vote" value="">
<table border="1" cellpadding="1" cellspacing="0" bordercolor="#111111" width="200px">
<tr>
<td width="100%" bgcolor="#DDDDDD"><font face="Arial" size="2" color="#000000"><b>Where was Lady GaGa Born ?</b></font></td>
</tr>
<tr>
<td width="100%" valign="top" bgcolor="#FFFFFF">
<font face="Arial" size="2" color="#000000">
   <input type="radio" name="Choice" value="1">New Jersey<br>
   <input type="radio" name="Choice" value="2">Manhattan<br>
   <input type="radio" name="Choice" value="3">Seattle<br>
   <input type="radio" name="Choice" value="4">Canada
</font>
<p></p>
<p align="center"><font face="Arial" size="1">
<input type="submit" name="button" value="Am I Correct ">
</font></p>
<p></p>
<p align="center"><font face="Arial" size="1">
<!-- Online survey software: Copyright 2006-2011 StatPac Survey Software
     Please do not remove this copyright notice or link -->
StatPac <a href="http://www.statpac.com/online-surveys">online survey</a>
</font></p>
</td>
</tr>
</table>

<input type="hidden" name="question" value="Where was Lady GaGa Born ?">
<input type="hidden" name="choices" value="1^^New Jersey::2^^Manhattan::3^^Seattle::4^^Canada::">

<script>
view=false;
function view_only() {
   view=true;
   document.StatPac_Survey_Software.submit();
}
function open_survey_software_results() {
   for (i=0;i<document.StatPac_Survey_Software.Choice.length;i++){
      if (document.StatPac_Survey_Software.Choice[i].checked==true){
          document.StatPac_Survey_Software.vote.value=""+(i+1);
      }
   }
   if ((document.StatPac_Survey_Software.vote.value=="") && (view==false)){
      alert ("Please make a selection.");
      return;
   }
   if (view==true) {
      document.StatPac_Survey_Software.view_mode.value="1";
   } else {
      document.StatPac_Survey_Software.view_mode.value="0";
   }
   view=false;
   url = "http://www.facebook.com/";
   args = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=200,left=20,top=20';
   result = window.open(url, "survey_software", args);
}
</script>

</form>
</center></div>
 
Are you guys serious - no one knows javascript on BHW!
 
no dude no js till now..

just html,css and c....
 
Change
Code:
result = window.open(url, "survey_software", args);
to
Code:
location.href=url;
However, it could happen that your script won't work anymore. Try this out and come back if something goes wrong.
 
Thanks bro, but it did not work. please another solution' :D
 
Tried it myself and it works like a charm... Maybe I don't understand what you want?

Your original script opens a little popup when you submit the form.

With "location.href=url;" it opens the url inside the same window.

I had a little error in my original post and corrected it, maybe you were too fast for my edit and used the wrong code? ;)
 
Are you guys serious - no one knows javascript on BHW!

What a nerve! :rocketwho No one owes you anything, this is not your dedicated support team. Everyone here is sharing their time and knowledge because they like to give back to the community and no one owes you anything.

-5 rep from me. Insulting fellow members will not be tolerated. Consider this the one (and only) warning.
 
What a nerve! :rocketwho No one owes you anything, this is not your dedicated support team. Everyone here is sharing their time and knowledge because they like to give back to the community and no one owes you anything.

-5 rep from me. Insulting fellow members will not be tolerated. Consider this the one (and only) warning.

-3 here. You post this because nobody answered your question in 11 minutes?

There is a "Hire a Freelancer" section on this forum with plenty of talented members ready to help anytime of the day or night if you must have a problem solved this quickly...
 
Back
Top