![]() |
|
|
+ Search |
![]()
|
Apr 8th, 2008 18:10
ha mo, Srinivas Vemula,
IE4+ and Mozilla (at least with current M0.8 so expect that to work in
later NN6 releases) allow to change the selection, both by manipulating
so called ranges, though the apis of IE and Mozilla differ strongly.
Here is an example
<HTML>
<HEAD>
<SCRIPT>
function selectElement (element) {
if (document.selection) {
var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();
}
else if (window.getSelection) {
var range = document.createRange();
range.selectNodeContents(element);
var selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
}
</SCRIPT>
</HEAD>
<BODY>
<DIV ONCLICK="selectElement(this)">
Kibology for all.
</DIV>
<span ONCLICK="selectElement(this)">
All for Kibology.
</span>
</BODY>
</HTML>
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com