Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Javascript problems....

Javascript problems....
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2004
Status: Offline
Reply With Quote
Oct 17, 2004, 04:29 PM
 
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
Reply With Quote
Oct 17, 2004, 06:17 PM
 
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
Reply With Quote
Oct 17, 2004, 06:27 PM
 
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
Reply With Quote
Oct 17, 2004, 06:29 PM
 
Hey Blackbook, that was quick!
Computer thez nohhh...
     
Fresh-Faced Recruit
Join Date: Jun 2004
Status: Offline
Reply With Quote
Oct 17, 2004, 07:06 PM
 
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
Reply With Quote
Oct 18, 2004, 03:54 AM
 
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
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:16 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2