How to register java script files and not including the whole script in the page but by using a seperate file in some directory, I am using a master page and I am having problems to figure a way to include scripts in content pages.
How to register java script files and not including the script in the page?
You need to include your external javascript file if you dont wish to write a code itself into your document.
You only have to write::::
%26lt;script language="javascript" type="text/javascript" src="filename.js"%26gt;%26lt;/script%26gt;
%26gt;%26gt; where filename.js is a name of the file you wish to include and give a relative path if thats in the other folder %26lt;%26lt;
Thats it. Cheers!..
Reply:Write your java script in its own plain-text file and give it the extension .js. Upload the .js file to your webspace.
Now in your webpage, put a script tag like this:
%26lt;script type="text/javascript" src="http://www. website.com/the_location_of_your _/script.js"%26gt;%26lt;/script%26gt;
Or if you're writing your page using XHTML rather than HTML, you can make it just a teeny bit shorter, like this:
%26lt;script type="text/javascript" src="http://www. website.com/the_location_of_your_ /script.js"/%26gt;
You can put the script in either the body or the head. One may be preferable over the other, depending on the situation.
Reply:Create a separate text file containing the Javascript code. Then, in your HTML page, use a tag like this example to include it:
%26lt;script language="javascript" src="myscript.js" type="text/javascript"%26gt;%26lt;/script%26gt;
Well, okay, this Yahoo answers thing is cutting off the end of the /script tag no matter what I try. You know how it ends.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment