Title: Can&#8217;t run Java script in Post
Last modified: August 18, 2016

---

# Can’t run Java script in Post

 *  Resolved [kfinchsigmate](https://wordpress.org/support/users/kfinchsigmate/)
 * (@kfinchsigmate)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/cant-run-java-script-in-post/)
 * I’ve been trying for a few days, unsuccessfully, to run a javascript inside a
   post on WordPress. I’ve added the following code:
 * ‘<script type=”text/javascript” src=”jmol/Jmol.js”>
    <script type=”text/javascript”
   > jmolInitialize(“jmol”); jmolApplet(200, “load ethane.mol”);’
 * I know the paths are right because I can run it by cut and pasting (and editing
   the paths) of the simple example found here:
    [http://jmol.sourceforge.net/demo/jssample0/](http://jmol.sourceforge.net/demo/jssample0/)
 * I see nothing on the post when I view it using that code. Please help! (the wysiwyg
   editor is off, and it isn’t adding or removing anything)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/cant-run-java-script-in-post/#post-504252)
 * This might help:
    [http://codex.wordpress.org/Using_Javascript](http://codex.wordpress.org/Using_Javascript)
 *  Thread Starter [kfinchsigmate](https://wordpress.org/support/users/kfinchsigmate/)
 * (@kfinchsigmate)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/cant-run-java-script-in-post/#post-504268)
 * That’s actually the page I used, but couldn’t find out what I was doing wrong
   from it. It seems like my code is just fine…
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/cant-run-java-script-in-post/#post-504271)
 * _I know the paths are right_
    I doubt that…
 * Let’s say you put that call in this post:
    [http://www.thechemblog.com/?p=367](http://www.thechemblog.com/?p=367)
 * What your code says is: “look for the JS here” –
    [http://www.thechemblog.com/?p=367/jmol/Jmol.js](http://www.thechemblog.com/?p=367/jmol/Jmol.js)
 *  Thread Starter [kfinchsigmate](https://wordpress.org/support/users/kfinchsigmate/)
 * (@kfinchsigmate)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/cant-run-java-script-in-post/#post-504363)
 * Well, I’ve tried to screw with the paths in multiple ways… I’ve changed it so
   that it was “[http://www.thechemblog.com/jmol/Jmol.js&#8221](http://www.thechemblog.com/jmol/Jmol.js&#8221);
   I’ve change it to “../../jmol/Jmol.js”
 * It just doesn’t seem to work. I have it like this now (which doesn’t seem to 
   work):
 * <script type=”text/javascript” src=”/jmol/Jmol.js”>
    <script type=”text/javascript”
   > jmolInitialize(“/jmol”); jmolApplet(200, “load ethane.mol”); </script>
 * Are there any simple javascripts I can try out to see if I can get those to work?
 *  Thread Starter [kfinchsigmate](https://wordpress.org/support/users/kfinchsigmate/)
 * (@kfinchsigmate)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/cant-run-java-script-in-post/#post-504378)
 * Alright… I can get the script to work if I do this:
 * <script src=”[http://stud4.tuwien.ac.at/%7Ee0425252/blog/jmol/Jmol1.js&#8221](http://stud4.tuwien.ac.at/%7Ee0425252/blog/jmol/Jmol1.js&#8221);
   type=”text/javascript”></script>
    <div style=”border:1px solid grey;”> <script
   type=”text/javascript” src=”[http://stud4.tuwien.ac.at/%7Ee0425252/blog/morphin/morphin.js”></script&gt](http://stud4.tuwien.ac.at/%7Ee0425252/blog/morphin/morphin.js”></script&gt);
   </div>
 * morphin.js is just the following:
 * >  jmolInitialize(” [http://stud4.tuwien.ac.at/~e0425252/blog/jmol&#8221](http://stud4.tuwien.ac.at/~e0425252/blog/jmol&#8221););
   > 
   > jmolApplet(400, “load [http://stud4.tuwien.ac.at/~e0425252/blog/morphin/Morphin-AM1.mol&#8221](http://stud4.tuwien.ac.at/~e0425252/blog/morphin/Morphin-AM1.mol&#8221););
 * so it should make sense that I should be able to replace the “script src=”[http://stud4.tuwien.ac.at/%7Ee0425252/blog/morphin/morphin.js”&gt](http://stud4.tuwien.ac.at/%7Ee0425252/blog/morphin/morphin.js”&gt);
   
   with just the verbage from the script, since it’s just a simple two line java
   script… which would look like this:
 * >  <script src=”[http://stud4.tuwien.ac.at/%7Ee0425252/blog/jmol/Jmol1.js&#8221](http://stud4.tuwien.ac.at/%7Ee0425252/blog/jmol/Jmol1.js&#8221);
   > type=”text/javascript”></script>
   >  <div style=”border:1px solid grey;”> <script
   > type=”text/javascript”> jmolInitialize(” [http://stud4.tuwien.ac.at/~e0425252/blog/jmol&#8221](http://stud4.tuwien.ac.at/~e0425252/blog/jmol&#8221););
   > jmolApplet(400, “load [http://stud4.tuwien.ac.at/~e0425252/blog/morphin/Morphin-AM1.mol&#8221](http://stud4.tuwien.ac.at/~e0425252/blog/morphin/Morphin-AM1.mol&#8221););
   > </script> </div>
 * but that doesn’t work – i get nothing. So, the question is, why doesn’t wordpress
   run the script i have in the HTML?
 *  Thread Starter [kfinchsigmate](https://wordpress.org/support/users/kfinchsigmate/)
 * (@kfinchsigmate)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/cant-run-java-script-in-post/#post-504379)
 * OH!
    Duh forgot the <!– … //–> between my script.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Can’t run Java script in Post’ is closed to new replies.

## Tags

 * [java](https://wordpress.org/support/topic-tag/java/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [kfinchsigmate](https://wordpress.org/support/users/kfinchsigmate/)
 * Last activity: [19 years, 3 months ago](https://wordpress.org/support/topic/cant-run-java-script-in-post/#post-504379)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
