Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 23rd, 2003, 11:44 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default Script src problem

I am using this line in my <head></head>:

<script language="javascript" src="myjsfile.js"></script>

and in myjsfile.js:

alert("something");

Nothing happens.

Am I the only one that has this problem? Am I doing something wrong?

All of my .js files have worked before, but now nothing happens...

Is there a common mistake or something?

Help would be greatly appreciated...

Thanks

Snib

__________________
-Snib - http://www.snibworks.com
Where will you be in 100 years?
 
Old December 23rd, 2003, 12:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hmmmm. odd. This is supposed to work the way you described it here.

Except for the obvious stuff (make sure the .js file is uploaded to your server as well, make sure the name of the file matches the src element of the script tag, don't use <script> tags in the myjsfile.js file) I can't think of a reason why this doesn't work.

Are you using Norton Internet Security? Is it suppressing errors in the .js file?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 23rd, 2003, 12:56 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Hello,

Suddenly, it works...

This is VERY strange, because I stopped messing with it while it was still doing nothing, and now I come back to it and it works!

I didn't do anything to it!

Well, I must have, I guess...

It must have been something obvious that I fixed without thinking, or some such thing.

I hope it keeps working...:)

Thanks for the quick reply

Snib

 
Old December 30th, 2003, 12:29 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You may have fallen victim to caching. Did you have something else in the JS file before you put the alert there? Sometimes even though you've changed the js file, the browser won't go back and get it. You could try forcing a complete refresh (hold shift in i.e. while clicking refresh) but this doesn't always work. This problem happens with CSS as well. Change the CSS and you have to make sure you "shift-refresh" to get the updated CSS file to the browser.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old December 30th, 2003, 01:25 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

On that last bit about caching.. When all else fails I usually just toast the temporary internet files directory from the Tools->Internet Options menu which completely clears the cache. That is very annoying and happens to me all the time!

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old December 30th, 2003, 03:33 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Thank you everybody...

If closing the browser completely refreshes, that must have been what happened, since it suddenly started working.

Thanks again,

Snib






Similar Threads
Thread Thread Starter Forum Replies Last Post
$@src newbieboobers XSLT 2 March 12th, 2008 04:22 PM
chapter2-src\src\ch02\sample5 _ need help M7777777bill BOOK: Professional Java Development with the Spring Framework 0 June 14th, 2006 10:00 PM
encoding JavaScript in src at script tag jimusa Javascript 1 October 25th, 2005 10:04 AM
How to compile from the src directory ? Joe Servlets 1 June 13th, 2003 01:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.