Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to Simulate onClick From Select Menu

Status
Not open for further replies.

smichener

Technical User
Sep 24, 2001
25
US
Hello all.

I have a dropdown list:

<select name="select" class="mapMenu" onChange="JumpToIt(this)">
<option selected value="none">Select a Tool --</option>
<option value="javascript:eek:nCreatePrintable()">Print Map</option>
<option value="javascript:eek:nFindLatLong()">Find Lat/Long</option>
</select>

That calls a script:

<SCRIPT LANGUAGE="JavaScript">
<!--
function JumpToIt(list) {
var newPage = list.options[list.selectedIndex].value
if (newPage != "None") {
location.href=newPage
}
}

//-->
</SCRIPT>

Which in turn selects an option from the original dropdown.

Works fine except.....

The options in the select call scripts that open new browser windows,
and when this occurs popup blockers swing into action and block the new
window. When I originally had the javascript calls as plain links such
as [HREF="javascript:eek:nCreatePrintable()"] the popup was not blocked
since it was obvious that user was clicking the link. Now that I'm
trying to save much needed space by putting these links into a
dropdown, the popup blockers are not recognizing the user selection....
I guess. I was thinking the javascript could somehow simulate an
onClick to alleviate the problem. Any suggestions?

Thanks

Steve,
 
If links work, then one option would be to create (or download) a DHTML select element replacement. You'd still save space, but the links would still be links.

You can probably use any drop-down menu script, to be honest.

There are many around, and a whole load can be found here:


Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Dan,

Thanks for the input, I'll take a look at that site. My goal is to keep it as simple as possible. I need to identify exactly why clicking a link does not cause the popup blocker to act, yet selecting from a simple html select does. Too bad I can't merely use onClick from within the dropdown somehow, or have it simulated in the javascript.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top