I have included some JavaScript and a form in my WordPress blog post. The whole thing works great when it's a standalone HTML page, but when I make it a WordPress post the "Highlight" (submit) button doesn't work. I suppose the WordPress formatting or markup is breaking things. But I use the text control plugin and my form still doesn't work even when I remove formatting and character encoding. How can I get my "Highlight" button to work? Below is the working HTML file, followed by the Wordpress blog code (the only difference is that the Wordpress code lacks tags like: <html> <head> </head> <body> </body> </html> Code (markup): ) Here's the HTML file, try it for yourself: http://wordpress.pastebin.ca./684541 And here's the non-working WordPress code: http://wordpress.pastebin.ca./684542 Any ideas?
in wordpress find header.php (header) of your theme in themes->theme editor and put the javascript and stylesheet part of http://wordpress.pastebin.ca./684542 there with in head But codes bellow needs to be in the post it self.... either use code view of post editor or just add the code to single.php of your template (edit in themes->theme editor) # <h3>Usage Notes</h3> # Paste your text into the textbox and click <i>Highlight</i>. Certain words and phrases are highlighted. # # <form> # <textarea id=TA rows=10 cols=50 >Paste your text to here. Phrase list.</textarea><br /> # <input type="button" name="" value="Highlight" onclick="zxcHiLight('TA','Para2',HiliteAry,'hlite');document.getElementById('Para2').style.height='100px';document.getElementById('Para2').style.padding='5px';"/> # <div id="Para2" style="overflow:auto;width:500px;height:0px;background-Color:#FFFFCC;border:solid black 0px;" > # </div> # </form> HTML: Because javascript functions should be in header ...if that html does not fit in post u add to template by editing single.php of your template
I know this is a couple months old, but this really is good info. I was testing some onclick stuff in wordpress and moving the script to the header did the trick. Oddly it worked fine on the index page, but failed to work on the interior pages before. Everything is perfect know.