G
George Hester
function spawn(ev){
var oSelect = '';
var oFlag = false;
if (ns4 || ns6)
oSelect = document.getSelection();
else if (ie4 || ie5){
if (!ev)
ev = window.event;
oFlag = true;
oSelect = document.selection;
}
alert(oSelect.type);
}
if (oSelect == '')
return;
else{
//stuff
}
In Netscape 4.8 if text is not selected nothing happens which is what I want. Please
disregard the fact that oSelect.type is not Netscape compatible you are really
seeing only a partial of what I am doing.
The issue here comes from this page:
http://www.webreference.com/js/column12/selectionobject.html
where it says, "Therefore, comparing the value of document.selection.type with "None" on Internet Explorer 4.0x,
is equivalent to comparing the value returned by the document.getSelection() method with "" on Navigator 4.0x."
This seems not to be true in IE 5.5. For if I just click on the page which has the above funcion in it
I get "Text" not "None"
So I cannot do this:
if (oSelect == '' || oSelect.type = "None")
return;
else{
//stuff
}
Any suggestions how to fix this? Thanks.
var oSelect = '';
var oFlag = false;
if (ns4 || ns6)
oSelect = document.getSelection();
else if (ie4 || ie5){
if (!ev)
ev = window.event;
oFlag = true;
oSelect = document.selection;
}
alert(oSelect.type);
}
if (oSelect == '')
return;
else{
//stuff
}
In Netscape 4.8 if text is not selected nothing happens which is what I want. Please
disregard the fact that oSelect.type is not Netscape compatible you are really
seeing only a partial of what I am doing.
The issue here comes from this page:
http://www.webreference.com/js/column12/selectionobject.html
where it says, "Therefore, comparing the value of document.selection.type with "None" on Internet Explorer 4.0x,
is equivalent to comparing the value returned by the document.getSelection() method with "" on Navigator 4.0x."
This seems not to be true in IE 5.5. For if I just click on the page which has the above funcion in it
I get "Text" not "None"
So I cannot do this:
if (oSelect == '' || oSelect.type = "None")
return;
else{
//stuff
}
Any suggestions how to fix this? Thanks.