• I am newbe converting an existing site to WordPress and have a test page at http://www.go-motion.com/jrmusic/stockists/

    This is a page which uses javascript to display a list of dealers in a given state.

    When I pasted the code from the existing site into a wordpress page in text view the script did not work.

    Obviously I am not doing this correctly.
    I need to use only one script on a single page there should be a simple way to do this

    <script type=”text/javascript” language=”JavaScript1.2″ src=”http;//www.go-motion.com/jrmusic/stores.js”></script>” should go in the header of the page
    then to get the list of dealers in the form when they click the button

    “input onclick=”go(this.form.SelectURL.options)” type=”button” value=”GO” />”

    I have searched to find a solution but the more I read the more confused I become.

    All suggestions will be gratefully received
    Many thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • You need to start by enqueuing your script correctly.

    Thread Starter Penelope01

    (@penelope01)

    Thankyou for your reply
    This was exactly the information that was so confusing
    I tried putting
    <?php wp_enqueue_script( stores, ‘/stores.js’, ‘false’ ); ?> on my page but it still doesnt work
    maybe I need to put this code somewhere else or I made a mistake
    If so where?
    The theme for the new website was developed using artisteer
    Many thanks for your help

    You enqueue scripts via your theme’s function.php file and hook them to the wp_enqueue_scripts action.

    Thread Starter Penelope01

    (@penelope01)

    Hi Esmi
    Thanks for the advice – trying to understand, but this is all new to me. I had thought that there would be an easy way to add my java scripts in wordpress !

    I generated my theme with artisteer. In my function.php file I have something that looks like

    wp_enqueue_script(“script.js”);

    Question – Is this where I have to add my line
    wp_enqueue_script( stores, ‘http://www.go-motion.com/jrmusic/stores.js&#8217; )
    or do I have to append the script itself into script.js ?

    Please can you help?

    I’m sorry but we do not support Artisteer themes here. Try asking on http://www.artisteer.com/?forum_id=13&p=forum_topics

    Thread Starter Penelope01

    (@penelope01)

    Hi again
    So I tried adding
    wp_enqueue_script(“stores.js”);
    underneath wp_enqueue_script(“script.js”); in the functions.php of my theme
    and I put the script stores.js in the same directory
    This didnt work

    Please can you help

    Thread Starter Penelope01

    (@penelope01)

    I’m sorry but we do not support Artisteer themes here

    Sorry but I thought that artisteer is only for designing theme templates

    Making the website work happens in wordpress. Lots of sites are using javascript, so it follows that there must be a simple way to make them work.

    Have you tried implementing it on a default theme?

    You could also look for a plugin for adding JS.

    Thread Starter Penelope01

    (@penelope01)

    You could also look for a plugin for adding JS

    Many Thanks
    You are a genius!
    I found a plugin called “Insert JavaScript and CSS” http://ww.wp.xz.cn/plugins/insert-javascript-css/
    It works on a single page which is exactly what I was looking for
    No messy coding and it worked first time!
    🙂

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

The topic ‘Javascript not working on page’ is closed to new replies.