Forum Moderators: open

Message Too Old, No Replies

Making Javascript file in an external file

         

j05hr

2:16 pm on Dec 30, 2008 (gmt 0)

10+ Year Member



I'm not sure if this is the right place to be posting this but as it's javascript i think it belongs here instead of HTML. Also i assume it's the same rules here as the css board where you can't post links?

Anyway on my website I have a contact form and it's come to validating the final site and the javascript is causing lots of errors. I know you can make the javascript an external file, however when I do make it external it still doesn't work. I'm not exactly sure what the javascript does as I didn't write it (I'm not too good with programming.) All i know is that the javascript calender doesn't load.

I'm using the method

<script type="text/javascript" src="contact.js"></script>

In my head tags and i've taken the script tags out of the external javascript file as i know they're not needed.

Any help greatly appreicated,

Josh

coopster

2:54 pm on Dec 30, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



That's not a lot to go on but let's start with error checking. Are you saying that the HTML is not validating? Or that your JavaScript is throwing errors? Are you using a browser that allows you to analyze the JavaScript as it is being processed (Firefox is great for this, using the FireBug extension).

j05hr

10:17 pm on Dec 30, 2008 (gmt 0)

10+ Year Member



Sorry i just know that in the css board if you post code relating to the site they say it's advertising your site and i assume it's the same here?

It's a contact form and it has javascript in it i took the javascript out so i could validate the page easier. I'm not sure what the problem is, all i know is that when the JS is in an external file it doesn't trigger as the JS has a JS calender that doesn't load.

How can i analyze the javascript as it's being processed as i do use Firefox.

ashish21cool

4:34 am on Dec 31, 2008 (gmt 0)

10+ Year Member



Hi,

Make sure that you have mentioned the right path to your external .js file.

Let me know more about this so that you can be suggested with a proper solution.

Best Regards.

j05hr

9:43 am on Dec 31, 2008 (gmt 0)

10+ Year Member



Yeah the path is right for the external file, i don't know how else to be more descriptive unless posting the code and then if i do, which code would you want me to post?

coopster

9:36 pm on Dec 31, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



In Firefox you can use Tools > Error Console to view your JS errors. However, there is an extension for Firefox called FireBug that is much more extensive for testing and troubleshooting.
[addons.mozilla.org...]
The makers of the extension have training videos out there on their site. If you are doing any amount of JS development then this tool is well worth investigating.

You can post relevant code in the forum, just remove any specifics and don't do any code dumps, hardly anybody will look at a monster code dump so be specific about your question(s).