One of my readers asked me if he could include Javascript code from external js.files. The answer is YES. To do so, create a new file with the extension .js, you can make a .js file from any normal javascript by removing the opening and closing tags.<script> </script>
. For example, here is a javascript for a vertical scrolling text.<script
language="JavaScript1.2">
var scrollerwidth=400 //change the scrollers height var scrollerheight=100 //change
the scrollers scroll speed (larger is faster) var speed=3 //change the scrollers
contents var scrollercontents='<font face="Arial" color="green"
size="5"><b>Place your content here.<br> Script distributed
by <a href="http://www.onlinebiz-my.blogspot.com">OnlineBiz-MY</a>
Please consider giving OnlineBiz-MY a link back when using this script.</b></font>'
if (document.all) document.write('<marquee direction="up" scrollAmount=' speed '
style="width:' scrollerwidth ';height:' scrollerheight '">' scrollercontents '</marquee>')
function regenerate(){ window.location.reload() } function regenerate2(){ if (document.layers){
setTimeout("window.onresize=regenerate",400) intializescroller() } }
function intializescroller(){ document.vscroller01.document.vscroller02.document.write(scrollercontents)
document.vscroller01.document.vscroller02.document.close() thelength=document.vscroller01.document.vscroller02.document.height
scrollit() } function scrollit(){ if (document.vscroller01.document.vscroller02.top>=thelength*(-1)){
document.vscroller01.document.vscroller02.top-=speed setTimeout("scrollit()",100)
} else{ document.vscroller01.document.vscroller02.top=scrollerheight scrollit()
} } window.onload=regenerate2 </script>
To make the above into a .js file, simply take out the first line<script language="javascript">
and the 2 lines at the bottom;"window onload & </script>"
.
Copy and paste that code into windows notepad and save it as scroller.js or whatever. Make sure when you save the file you choose "Save as type" is set to "All files".
To use the external script, point to the .js file in the "src" attribute of the tag:<html>
<head>
<script src="http://onlinebiz-my.googlepages.com/scroller.js"></script>
</head>
<body>
</body>
</html>
Note: Remember to place the script exactly where you normally would write the script!However, that some old browsers (e.g. Navigator 2.x and Explorer 3.x) cannot load external JavaScript files! Refer to tutorial on how to host your own js.file
2008-06-23
Blogging Tip : Include JavaScript code from external JS files
Posted by
Is
|
at
9:27 PM
|
Labels:
Blogging Tips
|
Estou lendo: Blogging Tip : Include JavaScript code from external JS filesTweet this!
| Feed.
Subscribe to:
Post Comments (Atom)
6 comments:
Tapi bukan itu maksud saya Is. maksudku adalah apakah new blogger template bisa menggunakan eksternal css?
Ismail, saya ingin make money online..
Is,bisa tidak anda buatkan posting tentang bisnis online, apa yang harus dilakukan pertama kali dalam bisnis online?
Saya ingin berguru pada anda, jujur saya miskin(Im Poor, I will make money from internet for my future)..
Terima kasih
Anton;
You may also link between the web page and the .css file by placing the following code into the the HEAD section of the web page:-
<LINK rel="stylesheet" type="text/css" href="http://onlinebusinessmy.googlepages.filename.css">
As for your request, If you think that you’re going to Make Money Off a Blog, there're tons of places and online ways for you to learn. Try Google.
Do not work is..
Berikut pesan blogger
Template Anda tidak dapat diparse karena tidak well-formed. Harap pastikan bahwa semua elemen XML ditutup dengan benar.
Pesan error XML: The element type "LINK" must be terminated by the matching end-tag "".
Maaf merepotkan
Anton,
As for the Blogger Template, you can't simply lump into one extension file. The template is divided into 2 sections i.e CSS and Html.
Post a Comment
1. Comments posted must be accompanied by names or pseudonyms.
2. Anonymous posting and those containing profanities will be rejected.
3. Comments are moderated due to spam problems. I have to approve the comment before it will show up.