i want to creat link using selected text.codes aren't working.how can i fix this?

<!doctype html>
<meta charset="utf-8">
<title>Untitled Document</title>
    border:1px solid black;

<div id="its" contenteditable="true" >
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
<input type="button" value="select and change" onClick="addLink();">
function addLink(){
var links=prompt("add link","http://");

You should try

function addLink(){

select some text of the document, click your addlink button and provide the location on the presented UI before hiting OK

mark solved threads general2012