September 01, 2003 - 11-Javascript Code
Open Link In New Window
This code shows how to open a hyperlinked page in a new window. The open statement is included in the hyperlink itself -- not calling a routine in the page header...
1:<a href="http://careo.elearning.ubc.ca/weblogs/vschools/walking.gif"
2:onclick="window.open
3:(
4:,
5:toolbar=no,directories=no,
6:location=no,menubar=no,status=no,left=0,top=0
7:return false">Walking Man</a>..
Posted by sachauncey at
04:00 PM
August 20, 2003 - 11-Javascript Code
Bookmark Site
1: You can do this in two simple steps.
Add the following JavaScript somewhere within the
<body></body> tags of each page in which you want to use the bookmark code:
2:
3: <script type="text/javascript">
4: sitetitl = "Pat Wong's Music Around The World"
5: siteurl = "http://www.napathon.net/"
6: function addBookmark(title,url) {
7: if (window.sidebar) {
8: window.sidebar.addPanel(title, url,"");
9: } else if( document.all ) {
10: window.external.AddFavorite( url, title);
11: } else if( window.opera && window.print ) {
12: return true;
13: }
14: }
15: </script>
16:
17: Be sure to change the values
of sitetitl and siteurl to match your website
18:
19: Here
20: <a href="#"
21: onmousedown="addBookmark(sitetitl,siteurl)">Bookmark</a>
22:
23:
24:
Posted by sachauncey at
01:50 PM
August 14, 2003 - 11-Javascript Code
Random Image Display
From DMXZone -
In the sample code there are 3 images, defined in var id = 3 ; change this to
the total number of images you wish to add in the script. Then you need to put the full list of images
with one line per image in the following format ranimage[number starting with 0 then 1, etc..] = "imagename.format";
1: script language="JavaScript" type="text/javascript">
2: // This script was supplied by Dave Joosten
4: < !-- var id = 3; // Total number of images
5: var ranimage = new Array(ic); // Array to hold the filenames
6:
7: ranimage[0] = "http://www.yourwebsite.com/graphic1.jpg";
8: ranimage[1] = "http://www.yourwebsite.com/graphic2.jpg";
9: ranimage[2] = "http://www.yourwebsite.com/graphic3.jpg";
10:
11: function choseRandom(range) {
12: if (Math.random)
13: return Math.round(Math.random() * (range-1));
14: else {
15: var now = new Date();
16: return (now.getTime() / 1000) % range;
17: }
18: }
19: //
20: var choice = choseRandom(id);
21: // -->
22: < /script>
23:
24:
Posted by sachauncey at
04:47 PM