Javascript For find Text or Control Location
The below is just a small example on what you can do with the API. Once the text is selected, you get its offset in pixels which you can then use to distinguish between the first and second foobar.If my snippet doesn't give you what you need, also read on selection and range.
<html>
<head>
<script>
function boundDim(oObject)
{
var oTextRange = document.selection.createRange();
if (oTextRange != null) {
alert("The bounding Text Left is :" + oTextRange.boundingLeft);
}
}
</script>
</head>
<body onclick="boundDim(this);">
Hello to all. Hello to me.
</body>
</html>
Search
Thursday, March 13, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment