hi, i want a simple display of two things: a textarea and how will it look. i hope u understand me. this is the code i used: <script language='javascript'> document.getElementById('testDemo').innerHTML="{$text}"; function doEdit() { document.getElementById('testDemo').innerHTML=document.getElementById('tos').value; } </script> <textarea name='tos' id='tos' cols=40 rows=15 onmousemove='doEdit()'>{$text}</textarea></td><td><div id='testDemo'></div> Code (markup): {$text} is a variable and is not the source of error,i am sure. the code worked,until i refreshed few times. plz help me.
Have you tried something like <textarea name='tos' id='tos' cols=40 rows=15 onmousemove='doEdit()' value='{$text}'></textarea> ?
jaimegm, PM me about the awesome stuff you're smoking man. Seems like you're pretty stoned. Oh yea, <textarea> doesn't have a "value" attribute BTW.....Â
i tried this and it worked 100% fine: <script language='javascript'> function doEdit() { document.getElementById('testDemo').innerHTML=document.getElementById('tos').value; } </script> <textarea name='tos' id='tos' cols=40 rows=15 onmousemove='doEdit()'>{$text}</textarea><div id='testDemo'>{$text}</div> Code (markup):
the problem with your code is that you executed document.getElementById('testDemo').innerHTML="{$text}"; before the <div id='testDemo'></div> element is created, what you can do is move your script after <div id='testDemo'></div>. it will look something like this...  <textarea name='tos' id='tos' cols=40 rows=15 onmousemove='doEdit()'>{$text}</textarea></td><td><div id='testDemo'></div> <script language='javascript'> document.getElementById('testDemo').innerHTML="{$text}"; function doEdit() {  document.getElementById('testDemo').innerHTML=document.getElementById('tos').value; } </script> HTML:
i don't think that matters......... the code i provided is not the complete code m using. in the actual code, <div id='testDemo'></div> came first anyways thx for the effort........