Jump to content

refresh .js file


joecool2005
 Share

Recommended Posts

Hi,On my html page I call a .js file like this<script src="test.js" language="javascript"></script>display()On test.js I have this code:<script language=javascript>function display(){ document.write("this is a test");}If I make any changes on test.js file, how can I refresh the .js file anytime a user call the html page?I have add those 2 lines already on my HTML page<META HTTP-EQUIV="Pragma" CONTENT="no-cache"><META HTTP-EQUIV="Expires" CONTENT="-1">and it still not working.ThxJoe

Link to comment
Share on other sites

Your post is a little confusing.Do you have separate html and js files or is the js contained in the html file?If the former is the case and you want the function to load when the page does, then put this in your head section:<script type=text/javascript src="test.js">display()</script>

Link to comment
Share on other sites

oops...sorry, had a brain hiccup on my reply.here's what your files should look like:test.htm

<html><head><script type=text/javascript src="test.js"></script></head><body onload="javascript:display()"></body><html>

and here's test.js:

function display(){document.write("this is a test");}

Link to comment
Share on other sites

Thank you for your reply.My .js is called inside the html file.For now, on my js file I have only 1 function. What happen if I have a lot of function on my js file? I dont want to call all of them in the same time. I just want to call when I need it.Thx for your help

oops...sorry, had a brain hiccup on my reply.here's what your files should look like:test.htm
<html><head><script type=text/javascript src="test.js"></script></head><body onload="javascript:display()"></body><html>

and here's test.js:

function display(){document.write("this is a test");}

Link to comment
Share on other sites

you just call the functions as you require them...they can be done on page load within the body tag as you sawthey can be an onclick event:<a onClick="OpenPopup('hours_shift_example.htm')" href="#">Example</a>they can be called by other user action such as mouseover, etc.explore the javascript tutorial.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...