mattal999 Posted October 12, 2007 Share Posted October 12, 2007 Hi, i have this script: <html> <head> <title>File Editor</title> </head> <script language="JavaScript" type="text/javascript" src="wysiwyg.js"> </script> <script> function test() { var content = document.example.content.value; document.getElementById("prev").innerHTML = "<a href='test.php?content="; document.getElementById("prev2").innerHTML = "content"; document.getElementById("prev3").innerHTML = "' target='_blank'>"; } </script> <body> <center><form name='example' method='POST' action='write.php?file=<? echo $file; ?>'> <textarea id="content" name='content' style="height: 415; width: 700;" rows="1" cols="20"><? echo $content; ?></textarea> <script language="javascript1.2"> generate_wysiwyg('content'); </script><br> <input type='image' border='0' src='buttons/button.bmp' name='submit'> </form> <p><div id='prev'><script>test();</script></div><div id='prev2'></div><div id='prev3'></div><img src='buttons/button2.bmp' border='0' onmouseover='javascript:test();'></a> </body> </html> and i want it to dynamically change when the button is hovered over. However, even this doesn't work... help please! Link to comment https://forums.phpfreaks.com/topic/72978-textarea-fetching/ Share on other sites More sharing options...
fenway Posted October 12, 2007 Share Posted October 12, 2007 You get resetting innerHTML... built a string first, then assign it once. Link to comment https://forums.phpfreaks.com/topic/72978-textarea-fetching/#findComment-368020 Share on other sites More sharing options...
mattal999 Posted October 12, 2007 Author Share Posted October 12, 2007 i got this: <html> <head> <title>File Editor</title> </head> <script language="JavaScript" type="text/javascript" src="wysiwyg.js"> </script> <script> function test() { var content = document.example.content.value; var contentstring = '<a href='test.php?content=' + content + '' target='_blank'>'; document.getElementById("prev").innerHTML = "+contentstring+"; } </script> <body> <center><form name='example' method='POST' action='write.php?file=hi2.php'> <textarea id="content" name='content' style="height: 415; width: 700;" rows="1" cols="20"><P align=center> <IMG alt="" src="http://www.games4uonline.com/drag/images/logo.png" border=0 alignment=""></P> <P align=center><FONT face=Verdana size=2>Hello and welcome to Drag Racer 2!</FONT></P></textarea> <script language="javascript1.2"> generate_wysiwyg('content'); </script><br> <input type='image' border='0' src='buttons/button.bmp' name='submit'> </form> <p><div id='prev'><script>test();</script></div><img src='buttons/button2.bmp' border='0' onmouseover='javascript:test();'></a> </body> </html> but still no change... Link to comment https://forums.phpfreaks.com/topic/72978-textarea-fetching/#findComment-368023 Share on other sites More sharing options...
mattal999 Posted October 12, 2007 Author Share Posted October 12, 2007 i also tried this and nothing happens: <html> <head> <title>File Editor</title> <script language="JavaScript" type="text/javascript" src="wysiwyg.js"> </script> <script> function test() { var content = document.example.content.value; document.getElementById("prev").innerHTML = "" + "<a href='test.php?content="+content+"' target=_blank>"; } </script> </head> <body> <center><form name='example' method='POST' action='write.php?file=<? echo $file; ?>'> <textarea id="content" name='content' style="height: 415; width: 700;" rows="1" cols="20"><? echo $content; ?></textarea> <script language="javascript1.2"> generate_wysiwyg('content'); </script><br> <input type='image' border='0' src='buttons/button.bmp' name='submit'> </form> <p><div id='prev'><script>test();</script></div><img src='buttons/button2.bmp' border='0' onmouseover='javascript:test();'></a> </body> </html> Link to comment https://forums.phpfreaks.com/topic/72978-textarea-fetching/#findComment-368050 Share on other sites More sharing options...
emehrkay Posted October 12, 2007 Share Posted October 12, 2007 works in ff <html> <head> <title>File Editor</title> <script language="JavaScript" type="text/javascript" src="wysiwyg.js"> </script> <script> function test() { var content = document.example.content.value; document.getElementById("prev").innerHTML = "" + "<a href='test.php?content="+content+" target=_blank>"; } </script> </head> <body> <form name='example' method='POST' action='write.php?file=<? echo $file; ?>'> <textarea id="content" name='content' style="height: 415; width: 700;" rows="1" cols="20"><? echo $content; ?></textarea> <script language="javascript1.2"> //generate_wysiwyg('content'); </script><br> <input type='image' border='0' src='http://www.google.com/logos/pavarotti.gif' name='submit'> </form> <p><div id='prev'></div><img src='http://www.google.com/logos/pavarotti.gif' border='0' onmouseover='javascript:test();'></a> </body> </html> Link to comment https://forums.phpfreaks.com/topic/72978-textarea-fetching/#findComment-368255 Share on other sites More sharing options...
mainewoods Posted October 14, 2007 Share Posted October 14, 2007 document.getElementById("prev").innerHTML = "" + "<a href='test.php?content="+content+" target=_blank>"; --you're innerHTML'ing incomplete html, you're missing the closing link tag: document.getElementById("prev").innerHTML = "" + "<a href='test.php?content="+content+" target=_blank>" + 'testlink</a>'; --always innerHTML well formed html, properly nested with all closing tags, or many browsers will not render it (as well they shouldn't). --you also shouldn't be putting the 'content' javascript variable on the url without url escaping it. Link to comment https://forums.phpfreaks.com/topic/72978-textarea-fetching/#findComment-369551 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.