K
Kelly McDonald
Hello all,
Please redirect me if this is the wrong place to post this.
I have figured out how to make a regular click in a multiselect work
like a <ctrl>-click in Mozilla, however, I've had a beast of a time
doing it in IE,
I have tried stuff like:
event.cancelBubble = true, event.returnValue = false;
return false;
in a handler function. It doesn't seem to matter what level I try to
capture it at, it still has the same (old) behavior in the multi select
control (IE 5.5)
For reference, This works great in Mozilla (1.4) (modified behavior in
the first multiselect, normal behavior in the second) Any ideas? Thanks!:
<select id ="selectme" multiple>
<option>me</option>
<option>me2</option>
<option>me3</option>
</select>
<select id ="selectme2" multiple>
<option id="x">me</option>
<option id="y">me2</option>
<option id="z">me3</option>
</select>
<script language="javascript">
function mousedown(e)
{
if (!e.ctrlKey && !e.shiftKey)
{
e.preventDefault();
e.stopPropagation();
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent(
e.type,
e.bubbles,
e.cancelable,
e.view,
e.detail,
e.screenX,
e.screenY,
e.clientX,
e.clientY,
true,
false,
false,
false,
0,
null);
e.target.dispatchEvent(evt);
}
}
function stopmouse(e)
{
alert(e);
e.preventDefault();
e.stopPropagation();
}
el = document.getElementById("selectme");
el.addEventListener("mousedown", mousedown, true);
</script>
Please redirect me if this is the wrong place to post this.
I have figured out how to make a regular click in a multiselect work
like a <ctrl>-click in Mozilla, however, I've had a beast of a time
doing it in IE,
I have tried stuff like:
event.cancelBubble = true, event.returnValue = false;
return false;
in a handler function. It doesn't seem to matter what level I try to
capture it at, it still has the same (old) behavior in the multi select
control (IE 5.5)
For reference, This works great in Mozilla (1.4) (modified behavior in
the first multiselect, normal behavior in the second) Any ideas? Thanks!:
<select id ="selectme" multiple>
<option>me</option>
<option>me2</option>
<option>me3</option>
</select>
<select id ="selectme2" multiple>
<option id="x">me</option>
<option id="y">me2</option>
<option id="z">me3</option>
</select>
<script language="javascript">
function mousedown(e)
{
if (!e.ctrlKey && !e.shiftKey)
{
e.preventDefault();
e.stopPropagation();
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent(
e.type,
e.bubbles,
e.cancelable,
e.view,
e.detail,
e.screenX,
e.screenY,
e.clientX,
e.clientY,
true,
false,
false,
false,
0,
null);
e.target.dispatchEvent(evt);
}
}
function stopmouse(e)
{
alert(e);
e.preventDefault();
e.stopPropagation();
}
el = document.getElementById("selectme");
el.addEventListener("mousedown", mousedown, true);
</script>