I want to know if it's possible to load scripts from a different file [instead of rewriting the same codes for every page] just using HTML and CSS. Something similar to PHP's include function [excluding the use of frames, I don't like frames].
Load scripts from another file
<!--#include file="inc/footer.html" -->
^ that may/may not work depending on your server but you should be able to include files using something like that on your normal HTML page.
^ that may/may not work depending on your server but you should be able to include files using something like that on your normal HTML page.
| NewGuyinTown wrote: |
| I want to know if it's possible to load scripts from a different file [instead of rewriting the same codes for every page] just using HTML and CSS. Something similar to PHP's include function [excluding the use of frames, I don't like frames]. |
| Code: |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>example</title> <script type="text/javascript" src="f.js"></script> </head> <body onload="ff();"> </body> </html> |
| Code: |
| /* f.js */
function ff() { alert('Yay!'); } |
The hex kid is right. Simple write a script. Save it as .js (script must be in javascript). simply type in you html or other file
Then your ready to include. symply copy the code in everypage you wan't and then.... your own includer
| Code: |
| <script src"[your-name-of-script-here].js"></script> |
Then your ready to include. symply copy the code in everypage you wan't and then.... your own includer
