...

View Full Version : Simulate Button Click



arpan_de
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?

Thanks,

Arpan

6arredja
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">

<html>
<head>
<title>Page title</title>
</head>
<body>

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

</body>
</html>

arpan_de
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.

arpan_de
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!!

david_kw
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>This</option>
<option>That</option>
<option>The other</option>
</select>


david_kw

Looks like you found it yourself. :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum