javascript - text into textbox when onclick -
i want create link if user presses edit link, text turn text box information still in user inputted? have following code: ( when press edit button 'text here' should turn textbox, doesn't notify code has gone wrong :) appreciated.
<html> <head> <title>span text box - demo</title> <style type="text/css"> .replace { display:none; } </style> <script type="text/javascript"> function exchange(id){ var ie=document.all&&!window.opera? document.all : 0 var frmobj=ie? ie[id] : document.getelementbyid(id) var toobj=ie? ie[id+'b'] : document.getelementbyid(id+'b') toobj.style.width=frmobj.offsetwidth+7+'px' frmobj.style.display='none'; toobj.style.display='inline'; toobj.value=frmobj.innerhtml } </script> </head> <body> <p class="edit" onclick="exchange(item)">edit</p><input id="item" class="replace" type="text" value=""> <span id="item" >text here</span> </body> </html>
you assigning 1 id 2 tag, code, assume id of input tag should itemb
Comments
Post a Comment