'expando' Example
<html>
<body>
<p id="myElement">Sample text, try to select part of it</p>
<script language="JavaScript">
function function1() {
myElement.setAttribute("unselectable", "off", 0);
document.expando = true;
}
function function2() {
myElement.setAttribute("unselectable", "on", 0);
document.expando = true;
}
</script>
<button onclick="function2();">Unselectable</button>
<button onclick="function1();">Selectable</button>
</body>
</html>
Related examples in the same category