Title: Help with javascript
Last modified: August 19, 2016

---

# Help with javascript

 *  [mayansoldier](https://wordpress.org/support/users/mayansoldier/)
 * (@mayansoldier)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/help-with-javascript/)
 * Hi! i’m having problems adding a javascript file in my wordpress theme for my
   blog. I’m using three javascript files; two for “nifty cube”(rounded corners)
   and one for the navbar menu but nothing seems to happen.This is my html:
 * > `<?php wp_get_archives(‘type=monthly&format=link’); ?>
   >  <?php //comments_popup_script();//
   > off by default ?> <?php wp_head(); ?>
 * <script type=”text/javascript” src=”niftycube.js”></script>
    <script type=”text/
   javascript” src=”niftysk.js”></script> </head> <body> <div id=”logo”> </div> 
   <div id=”envoltura”> <div id=”menu”> <script type=”text/javascript” src=”menu_.
   js”> </script>`
 * Please, help me. Any reply will be appreciated.
    thanks

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

 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/help-with-javascript/#post-946667)
 * You need to use absolute (http) or site root relative (leading slash) links.
 * Also see: [http://codex.wordpress.org/Using_Javascript](http://codex.wordpress.org/Using_Javascript)
 *  Thread Starter [mayansoldier](https://wordpress.org/support/users/mayansoldier/)
 * (@mayansoldier)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/help-with-javascript/#post-946670)
 * sorry! what does that mean?
    I’m a still little newbie in html
 *  Thread Starter [mayansoldier](https://wordpress.org/support/users/mayansoldier/)
 * (@mayansoldier)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/help-with-javascript/#post-946671)
 * Thanks a lot, i figured out what did you mean. But it didn’t work.
 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/help-with-javascript/#post-946672)
 * src=”niftycube.js” is a relative link, something that you cannot use with WordPress.
   Put the http address of your javascript file in here instead.
 *  Thread Starter [mayansoldier](https://wordpress.org/support/users/mayansoldier/)
 * (@mayansoldier)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/help-with-javascript/#post-946673)
 * Can i put a directory in my hard drive instead of an http adress?
    Its cause 
   I’m using a dummy wordpress installed on my pc to develop this theme.
 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/help-with-javascript/#post-946679)
 * You can put the javascript file in your current theme’s folder and then use:
 * `src="<?php bloginfo('template_url'); ?>/niftycube.js"`
 *  Thread Starter [mayansoldier](https://wordpress.org/support/users/mayansoldier/)
 * (@mayansoldier)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/help-with-javascript/#post-946691)
 * Oh man! thanks a lot! I couldn’t get to work the rounded corners script but i
   could with the menu script and thats enough
    Thanks a lot!!!
 *  [simoneoor](https://wordpress.org/support/users/simoneoor/)
 * (@simoneoor)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/help-with-javascript/#post-947092)
 * Many thanks from me as well. Spent all morning trying to get my javascript to
   work in the template, and it is this last tip from “iridiax” that finally sorted
   it!
 * To recap (in case there are other beginners like me out there):
 * in header.php, created after the meta section:
 * <script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/Scripts/
   myscriptfile.js”></script>
 * In the template index.php (somewhere in body between divs, but not in a post 
   in this case):
 * <script type=”text/javascript”><!–//–>
    <![CDATA[//><!– myfunction(); //–><!]]
   > </script>
 *  [t31os](https://wordpress.org/support/users/t31os/)
 * (@t31os)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/help-with-javascript/#post-947093)
 * Ah hah … spotted…
 * `<?php bloginfo('template_url'); ?>`
 * Been looking for a template URL function (well not been looking but waiting to
   see something for handling it)… 🙂
 * Not related i know, but helpful to me… 🙂

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

The topic ‘Help with javascript’ is closed to new replies.

## Tags

 * [adding](https://wordpress.org/support/topic-tag/adding/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 4 participants
 * Last reply from: [t31os](https://wordpress.org/support/users/t31os/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/help-with-javascript/#post-947093)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
