I think you will find the code for Mozilla and Firefox is different than for IE, so you might consider the code below, also checking for Mozilla as well as firefox (I hate pages that assume that firefox is the only Mozilla like browser. Mozilla and Netscape existed long before firefox and still Mozilla beats FF for rendering) --
Main Topics
Browse All Topics





by: GaryRasmussenPosted on 2008-06-24 at 16:24:08ID: 21861475
Here ya go
xtWrite")
USEUP)
ange().tex t != '') Range().te xt) tPos, endPos)
<html>
<head>
<title></title>
<script language=javascript>
function Init()
{ var box = document.getElementById("t
box.onmouseup = MouseUp
if (box.captureEvents)
{ box.captureEvents(Event.MO
}
}
function MouseUp(e)
{ if (!e) var e = window.event
var box = (e.srcElement) ? e.srcElement : e.target
var selText = GetSelectedText(box)
alert (selText)
}
function GetSelectedText(input)
{ if (document.selection && document.selection.createR
{ return (document.selection.create
}
else
{ var startPos = input.selectionStart
var endPos = input.selectionEnd;
return input.value.substring(star
}
}
</script>
</head>
<body onload="Init()">
<form ID="Form1">
<textarea id="txtWrite" rows="20" cols="20"></textarea>
</form>
</body>
</html>