 |
 |
Javascript problems....
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jun 2004
Status:
Offline
|
|
Hi guys-
I was wondering if anyone could help with a Javascript problem I'm having:
http://www.mysteriousal.com/dynamic/frameindex.html
I'm generating popup windows to bespoke sizes from a pulldown menu.
The problem I'm having is that the user cannot 'reselect' the same item twice in a row. They have to visit a different one in-between...
Any ideas would be greatly appreciated. I can post the source here if it would help, although it's pretty long....
If anyone knows a fix for this, I would be most greatful 
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status:
Offline
|
|
Well, the event you're using is onchange, hence it's only fired when the value of the select is changed. Seen here: <select onChange="jump(this)">
Try using onclick instead - I think it will only fire when something is selected, rather than on every click (at least, it seems to work like this in Safari...). If that doesn't work and the event is actually fired on each click (like you'd presume it would...) then you'll be introducing more problems than it's worth. Also - why would people be reselecting something? Another option is to not use onchange on the <select>, but have a button they press to open the page (or still have the onchange with the button as an extra if it's needed - like on the forum jump select at the bottom of these forums...)
Oh, and the link you posted is wrong. URL's are case sensitive, so the capital FRAME needs to be like that 
|
|
Just who are Britain? What do they? Who is them? And why?
Formerly Black Book
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Originally posted by mysteriousal:
Hi guys-
I was wondering if anyone could help with a Javascript problem I'm having:
http://www.mysteriousal.com/dynamic/frameindex.html
I'm generating popup windows to bespoke sizes from a pulldown menu.
The problem I'm having is that the user cannot 'reselect' the same item twice in a row. They have to visit a different one in-between...
Any ideas would be greatly appreciated. I can post the source here if it would help, although it's pretty long....
If anyone knows a fix for this, I would be most greatful
It's because the option list has the 'onchange' event that you can't reselect your item without the inbetween step.
It would be straightforward to add an image or a button after that with an onclick event that pulls the value out of the option list and launches the popup.
A quick'n'dirty:-
Put this inside the < SCRIPT > in your HTML page, just before the function popUp
Code:
function get_popup(obj)
{
val = obj.dropdown[obj.dropdown.selectedIndex].value;
return popUp(val);
}
Then in your HTML, alter your popup like so...
Code:
<form method="get" action="frameindex.html"><!-- Let's be compliant ;) -->
<select name="dropdown" size="1">
<option selected="selected">#</option>
<option value="_blank|46.html|width=800,height=500">#47</option>
<option value="_blank|45.html|width=950,height=500">#46</option>
...etc...
</select>
<input type="image" src="path/to/scary/arrow.gif" onclick="get_popup(this.form)" />
</form>
Then your visitors need only click the arrow everytime they want to review the folio.
I guess you could also keep the 'onchange', but that may confuse visitors if they see a submit button and would expect to have to click that before the popup happened. Some browsers will also block popups if they don't originate from a user-initiated event.
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Hey Blackbook, that was quick! 
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jun 2004
Status:
Offline
|
|
Wow! Many thanks for the quick replies!
Firstly, please excuse my tardiness for posting the wrong URL! I'm tired!
I can absolutely see the benefits of adding an actual button or image to actually open the popup- But this isn't really what I want...
The OnClick command works- But is a little confusing, as it's on mouse up, so the button has to be held whilst making the selection.... Hmmm, Or does it? I'm confusing myself here!
Many thanks to you all for your help- I will continue to play with this!
Best-
al
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status:
Offline
|
|
Originally posted by Simon Mundy:
Hey Blackbook, that was quick!
What can I say? I'm a web dev forum helping machine 
|
|
Just who are Britain? What do they? Who is them? And why?
Formerly Black Book
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|