I'm trying to put some simple javascript calculators in a post on my wordpress run blog. I host it myself and can't figure out how to do it. I've looked at a few plugins but I'd rather do it by hand. If you go to http://codex.wordpress.org/Using_Javascript#Javascript_in_Posts it tells you how but I don't quite understand. I know how to call stuff to an extant but I'm a little confused. If any one could give me just a working example that would be absolutely great. Thanks guys and I hope someone can help.....
One thing you need to do is make sure you are using the html editor instead of the visual editor (It's a tab on the editor). From there it should just be copy and paste if the js is correct.
I checked the link you provided, it simply means but your JS code into a .js file and upload it to your server, then call it from within the post, after than use the functions you need, as an alternative to putting it into the header
It doesn't work that way Wordpress strips out javascript even when you use the html editor. Thats the part that confuses me. I can create the javascript file no problem and upload it but how do I call it? I tried but to no avail. Any chance someone could show me an example?
First off go to USERS ----> TEXT EDITOR and turn off the RICH EDITOR then go to your post, add: <script type="text/javascript" src="/scripts/updatepage.js"></script> // this should load your js file <script type="text/javascript"> <!-- updatepage(); // this here is just an example of the functions you have defined in the js file //--></script> Code (markup):