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

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -