Hello I'm using this code I got from an example:
<head>
<TITLE>Creating a link</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function createLink()
{
var szURL = prompt("Enter a URL:", "http://");
if ((szURL != null) && (szURL != "")) {
document.execCommand("CreateLink",false,szURL);
}
}
// -->
</SCRIPT>
</HEAD>
<BODY>
<H1>Creating a link</H1>
Here's some text. Select some and click the button to turn it into a hyperlink.
<BR />
<BUTTON ONCLICK="createLink()">Click to create the link</BUTTON>
</body>
</html>
It's working ok in IE, but in Firefox (3.5.3 I'm using), I get the following error:
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: [url]http://localhost/america/editora/simple2.html[/url] :: createLink :: line 11" data: no]
Line 0
I have googled for this error but seems nobody is having problems with it? Any help much appreciated, I'm a rookie in javascript.
(line 11 is the CreateLink line)