|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I´m sorry I had to get your attention that way ( ), but I have a very urgent question:I created a pop-up window Y from the main window X, and now I want to make it possible to select a link from a pull-down menu in Y - and the page should appear in X. Right now I use this form: <SCRIPT language="JavaScript"> <!-- function fenster() { opener.location.href = "../domain/" } //--> </SCRIPT> and this pull-down: <select name=site SIZE=1 onChange="fenster(this.form)"> <option value="http://www.yoursite.com">Go to.... <option value="http://www.yahoo.com">Yahoo <option value="http://www.metacrawler.com">Metacrawler <option value="http://www.altavista.digital.com">Altavista <option value="http://www.webcrawler.com">Webcrawler <option value="http://www.lycos.com">Lycos <option value="http://javascript.internet.com">JavaScript Source </select> </form> but now I only get to ../domain, doesn´t matter what option I select. Is it possible to modify this script to use for my purpose (right now it creates a pop-up, but it might help): <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function formHandler(form) { var windowprops = "height=500,width=500,location=no," + "scrollbars=no,menubars=no,toolbars=no,resizable=yes"; var URL = form.site.options[form.site.selectedIndex].value; popup = window.open(URL,"MenuPopup",windowprops); } // End --> </script> Could you please help me and tell me the code to use? Thanks so much, steve |
|
#2
|
|||
|
|||
|
You aren't using the value passed to fenster(). You are passing "this.form" as an argument to the function fenster() so you need to do something with it:
<SCRIPT language="JavaScript"> <!-- function fenster(arg) { opener.location.href = arg } //--> </SCRIPT> |
|
#3
|
|||
|
|||
|
thanks, but...
I want to keep the target url out of the <SCRIPT>...</SCRIPT>, the url should be taken from the <FORM>
How can I do that? |
|
#4
|
|||
|
|||
|
If you call the function with 'this' instead of 'this.form' you will be passing the drop down list instead of the form.
Then your function becomes: <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function formHandler(dropdown) { var windowprops = "height=500,width=500,location=no," + "scrollbars=no,menubars=no,toolbars=no,resizable=yes"; var URL = dropdown.options[dropdown.selectedIndex].value; popup = window.open(URL,"MenuPopup",windowprops); } // End --> </script> I think this is what you need. |
![]() |
| Viewing: Dev Shed Forums > Web Design > JavaScript Development > Javascript masters please help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|