View Full Version : Simulate Button Click

01-11-2007, 03:46 AM
A Form has a <select> list which lists all the directories & files residing in a directory on the server. Users have also been given the provision to navigate to sub-directories residing in this directory (I am doing this using ASP.NET).

To navigate to a sub-directory, a user has to select the sub-directory from the <select> list to which he wants to navigate to & then click a button (it's not the submit button; it's the usual button). The user is then taken to the selected sub-directory.

Apart from navigating to a sub-directory in this way, I also want to give users the option to navigate to a sub-directory by double-clicking a sub-directory in the <select> list i.e. when a user double-clicks a sub-directory in the <select> list, he should be taken to that sub-directory. In other words I want the double-click event on the <select> list item to simulate the button click event.

How do I do this?



01-11-2007, 04:25 AM
i have no idea if you can double click <selection>'s

but you can make an action happen such as submitting or whatever it is that you want to happen fairly easily

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<title>Page title</title>

<select onchange="alert('changed');">
<option selected>choose below</option>
<option>Option 1</option>
<option>Option 2</option>


01-11-2007, 09:36 PM
No, no, my dear 6arredja....that's not what I am looking out for.

Isn't there anything in JavaScript to catch a double-click event on any item in a <select> list?

Actually I have come across a few sites where I have seen double-clicking an item in a <select> list doing something.

01-11-2007, 09:46 PM
There's a OnDblClick event for <select> lists, my dear. That was what I was looking out for.

I already have a button click event function using which users can navigate to different sub-directories. I just assigned the same function to the OnDblClick event of the <select> list!

That's it!!

01-11-2007, 09:51 PM
It is called ondblclick. Try this example.

<select name="s" size="3" ondblclick="alert(this.options[this.selectedIndex].text);">
<option>The other</option>


Looks like you found it yourself. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum