|
|
Might be because those browser have a better inbuilt popup blocker. The fact that it's working in my FF is an annoyance to me.
|
._.
It works in Chrome if you press the button and don't use the drop-down menu to pop it open.
|
As you are experiencing, onClick() is not supported on the option-tag in many browsers. Instead you should use the "onChange()"-event for the select-tag and do whatever if a check shows the selected item is the one you want.
Edit: Also, I don't understand how you didn't find this out by searching. Almost every hit on the first page from a Google-search for "javascript option onclick" seems to be about this.
|
so - How do I have to change
<option value="Click here!" onChange="myPopup3()">Click here!</option>
?
|
Here's an example using onChange() (adapted from the first hit on Google for the search mentioned above): + Show Spoiler +<script type="text/javascript"> function changeFunc(valueSelected) { if(valueSelected == "Click here!") alert("You selected \'Click here!\'"); else alert("You selected something else"); } </script>
<select onchange="changeFunc(this.value);"> <option value="Select">Select an option</option> <option value="Click here!">Click here!</option> <option value="Hi there!">Hi there!</option> </select>
|
I'm sorry - I'm having a lot of problems following that. I don't see how to make it work.
|
I'm no Javascript-expert, but I can try a quick explanation
<select onchange="changeFunc(this.value);"> This means, when what's selected in the combo-box changes, the function named "changeFunc" is called. Passed on to the function is the value of the selected item (in "this.value", this refers to the <option> selected, so we're passing on the <option>'s value).
For example, if you have an selectable item defined by <option value="item1">Something</option> and selects it, the function changeFunc is called with "item1" as the argument.
function changeFunc(valueSelected) { if(valueSelected == "Click here!") alert("You selected \'Click here!\'"); else alert("You selected something else"); } This defines the function which is called when the selection changes. In it, I check if the passed argument (named valueSelected) is something I'm looking for. The function checks if the value is equal to "Click here!", and depending on if it is or not it display different messages.
In your case you don't want to display a message but rather open a window, so you'd change it to: + Show Spoiler +if(valueSelected == "Click here!") window.open("http://dev.ieworks.net/devtest/location_add.html","myWindow"," status=1, height=300, width=300, resizable=0"); That way, even though the function is called on every change in the combo-box, a new window is only opened when the change is that the item with value "Click here!" was selected.
Hopefully that helps
|
|
|
|