How to trigger this Function in new window and new window ONLY?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • khw118
    New Member
    • Jul 2010
    • 2

    #1

    How to trigger this Function in new window and new window ONLY?

    Hi there, in this site I am working on, I have a scroll down menu in the HOME page where user select an option and then press the button next to it, to be redirected to the related page (which is password protected).

    I would like this related page to open in a new Window, AND keep the HOME page unchanged.

    I have an onClick function called "gox1" to load the related page. When I try to put "window.ope n" in the statement/definition of the "gox1" function (see below), it simply load the related page in the original window, replacing the Home page AND open up an empty new window at the same time, which is not what I want.

    Codes shown below, any help on this will be much appreciated!!!

    Code:
      <form name="doublecombo">
    	<select name="ky" size="7" onChange="redirec(this.options.selectedIndex)" class="tablexx" target="_blank">
    	<option>Germany</option>
    	<option>USA</option>
    	</select>
    	<select name="stage" size="7" class="tablexx">
    	  <option value="http://google.com">Luna</option>
    	</select>
    
    <input type="button" name="test" value="Info"
    onClick="gox1()">
    
    <script>
    
    function gox1(){
    location=temp.options[temp.selectedIndex].value; window.open()
    }
    
    </script>
    </form>
    
    [B][/B]
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    You are manipulating the url-address of the current page with "location=. ..". But you should pass this address to the new page. (pass the address inside the brackets of window.open()) Read description of window.open() how to do.

    This is a JavaScript question, not a a Java question, so it should be moved to the corresponding forum.

    Comment

    • khw118
      New Member
      • Jul 2010
      • 2

      #3
      That solved my problem, thanks a lot for your help.

      Sorry I mistakenly posted this as a Java question...

      Comment

      Working...