Hello;
I have a js code that I don't want to put it in my web page, I want to have it in a .js file and then call it from web page, but there is a code (last code) that I am not sure if it should be inside the file or in the web page, appreciate your help, here is the code:
is it OK to have the js file like the following:
then,
if I call this "mycode.js, could I add the following codes in my web page to call it:
could these be right?
or the last code must be inside file, if so how to write it.
thanks
I have a js code that I don't want to put it in my web page, I want to have it in a .js file and then call it from web page, but there is a code (last code) that I am not sure if it should be inside the file or in the web page, appreciate your help, here is the code:
Code:
<!-- Start of code for [URL unfurl="true"]http://www.mywebsite.com[/URL] -->
<script type="text/javascript">
var nsSiteId=1;
var nsTrackPath='[URL unfurl="true"]http://www.mywebsite.com/statistic/test/default.html?';[/URL]
var nsTrackMode='default';
var nsCode=1;
</script>
<script type="text/javascript" src="[URL unfurl="true"]http://www.mywebsite.com.com/statistic/track.js"></script>[/URL]
<!-- End of code -->
is it OK to have the js file like the following:
Code:
var nsSiteId=1;
var nsTrackPath='[URL unfurl="true"]http://www.mywebsite.com/statistic/test/default.html?';[/URL]
var nsTrackMode='default';
var nsCode=1;
then,
if I call this "mycode.js, could I add the following codes in my web page to call it:
Code:
<script language="Javascript" type="text/javascript"src="[URL unfurl="true"]http://www.mywebsite.com/js-folder/mycode.js"></script>[/URL]
<script type="text/javascript" src="[URL unfurl="true"]http://www.mywebsite.com.com/statistic/track.js"></script>[/URL]
could these be right?
or the last code must be inside file, if so how to write it.
thanks