R
relaxedrob
Hi All,
I want to write a select control and use a Javascript function to
handle all click events on the control. Under certain circumstances I
also wish to prevent the dropdown's list from being rendered.
Here is a sample showing what I am _unsuccessfully_ trying to do. :-/
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function selectOnclick(e) {
// e gives access to the event in all browser
if (!e) var e = window.event;
if (e) { e.cancelBubble = true; }
return false;
}
</script>
</head><body>
<form name="test">
<select name="select" onmousedown="selectOnclick();">
<option value="one">one</option>
</select>
</form>
<script type="text/javascript">
document.test.select.onmousedown = selectOnclick;
</script>
</body>
</html>
Any advice would be most appreciated!
Rob
I want to write a select control and use a Javascript function to
handle all click events on the control. Under certain circumstances I
also wish to prevent the dropdown's list from being rendered.
Here is a sample showing what I am _unsuccessfully_ trying to do. :-/
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function selectOnclick(e) {
// e gives access to the event in all browser
if (!e) var e = window.event;
if (e) { e.cancelBubble = true; }
return false;
}
</script>
</head><body>
<form name="test">
<select name="select" onmousedown="selectOnclick();">
<option value="one">one</option>
</select>
</form>
<script type="text/javascript">
document.test.select.onmousedown = selectOnclick;
</script>
</body>
</html>
Any advice would be most appreciated!
Rob