Mozilla.com

  1. addRange
Table of contents
No headers

Can somebody PLEASE explain to me why this doesn't work as described in the documentation:

<script type="text/javascript"> function designModeOn(){ document.getElementById("contentFrame").contentDocument.designMode="on"; } function testMe(){ sel = contentFrame.getSelection(); range = document.getElementById("contentFrame").contentDocument.createRange(); sel.addRange(range); alert(sel); } </script> </head> <body bgcolor="#FFFFFF" onLoad="designModeOn()"> <iframe style="border: 1px solid #d0d0d0; width: 100%" id="contentFrame" name="contentFrame" src="test.html"></iframe>
<a href="#" onClick="testMe();">Test</a>

All I get from the code above is:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISelection.addRange]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///C:/Websites/dotAdmin/dotAdmi...ngetest2.html# :: testMe :: line 12" data: no]

Try asking in the mozilla DOM newsgroup. This is not the right place for such questions --Nickolay 01:34, 22 June 2006 (PDT)

Page last modified 08:34, 22 Jun 2006 by Nickolay

Tags:

Files (0)