Loading javascript into wordpress wp_enqueue_script() problem


Staff member
I am trying to get my custom javascript (jQuery) to load correctly in Wordpress.
I know you have to use wp_enqueue_script() to do this correctly. However the problem I have is that the result is not my script, but in the place I should have javascript I have the code for a 404 page !
I've tried two ways of enqueueing the script :

wp_enqueue_script('sitescript', get_bloginfo('template_directory').'/javascript/sitescript.js', array('jquery'),1);

just above wp_head()
and :
function my_script_load() {
    wp_enqueue_script('sitescript', get_bloginfo('template_directory').'/javascript/sitescript.js', array('jquery'),null);
add_action('init', 'my_script_load');

in functions.php

both methods have the same effect. When I inspect the HTML in firebug I find the script is corredtly referenced :

<script src="http://localhost/wordpress/wp-content/themes/doric2011/javascript/sitescript.js" type="text/javascript">

however when I inspect the script itself I find the following (an extract) :`

Page not found | Nick Kai Nielsen

and so on... It is a HTML output for a 404 page, but occupying a space where javascript should be...
Needless to say the script does not work.

I have only had this problem since updating to 3.1 and it does the same thing if I try loading highslide.js and highslide.config.js (professionally written scripts). The script I wish to load is already working on my site and I want to go on using it in the new theme I am developing.

has anyone any idea of what is happening ? And, of course, what should I do about it ?

This is a local installation - I'm not risking breaking my site until this is sorted out.