Java scripts

Go ahead: Copy and paste!

Gå til startsiden
The top of the iceberg
 

The picture's mouse-over-effect code is created this way:

Paste the following code in the page's <HEAD>:

<head>

<script language="JavaScript">
function xy(aktuelle,nyt)
{document.images[aktuelle].src = nyt;}
</script>

</head>

Next, paste this into the page's body:
<a href="../index_part2_e.html" onmouseover="xy('p1','../pics/skilt1.jpg');"
 onmouseout="xy('p1','../pics/skilt2.jpg');"><img src="../pics/skilt2.jpg"
 name="p1" alt="Gå til startsiden"
 border="0" width="244" height="183"></a><br>
Poter</h5>
Start creating .gif's or .jpg's. That way you can instantly see if the code works properly.
 
 

To animate hyperlinks on mouse-over, use this piece of java code in the page's <HEAD>:

<STYLE TYPE="text/css"><!--
A:hover { text-decoration: none;
          color: #ff0000;
          background: none #FFFFFF; }
--></STYLE>
 
 

The "Back" button is made by applying the following code after the end of the page's text (or whereever you want it):

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"><!--
document.write('<P><A HREF="javascript:history.back()">Tilbage<\/A><\/P>');
// --></SCRIPT>
 
 

The automatical dating of the pages is done with the following code. Paste the code where you want the date to appear:

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function makeArray()
{
  arg = makeArray.arguments;
  for (var i = 0; i < arg.length; i++)
    this[i] = arg[i];
}

daMod = document.lastModified;
if (daMod.indexOf("70") != -1)
  {
    // Hvis fildatoen er før 1-1-1970 kl. 01.00.00
    // (som hos get2net) så crasher Netscape 3.x
    // og MSIE 3.x ved brug af Date-objektet.
    // Da årstallet må være 70 - er fildatoen
    // alligevel forkert. Derfor skrives:
    document.write("Last update: Ikke understøttet af serveren");
  }

daMod = Date.parse(daMod);
if (daMod <= 1000 * 60 * 60)
  {
    // Nogle browsere f.eks. Opera før v. 3.5
    // understøtter ikke Date.parse().
    // Las os blot skrive fildatoen:
    document.write("Last update: " + document.lastModified);
  }
else
  {
    m = new makeArray("January", "February", "March", "April", "May",
                      "June", "July", "August", "September", "October",
                      "November", "December");
    daMod = new Date(daMod);
    document.write("Sidst opdateret: " + daMod.getDate() + ". ")
    document.write(m[daMod.getMonth()] + " ");
    year = daMod.getYear();
    year = (year < 1000) ? 1900 + year : year;
    document.writeln(year);
  }
//-->
</SCRIPT>
 
 

This is the code for the "print" button:

This part must be placed in the HEAD:
<SCRIPT LANGUAGE="JavaScript">
function myprint()
{
window.print();
}
//  End -->
</script>
And this can be placed anywhere on the page you want your button to appear on your page:
  <form>
<input type=button value="Print oversigten" onClick="myprint()">
</form>
Important! Remember to change the button's text. In Danish "Print" is spelled like this: "Print oversigten".
 
 

This bit controls the look of the scroll bar. - Every color ("#XXXXXX;") can be changed using the colorcode.

<style>
     Body {
        scrollbar-3dlight-color: #ffffff;
        scrollbar-arrow-color: #ffffff;
        scrollbar-base-color: #ffffff;
        scrollbar-darkshadow-color: #ffffff;
        scrollbar-face-color: #ffffff;
        scrollbar-highlight-color: #CCCCCC;
        scrollbar-shadow-color: #000099;
     }
  </style>
The code must be placed in the page's HEAD.
 

This is the code to the option: automatically bookmark page:

<script>
// (C) 3500 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header

// message to show in non-IE browsers
var txt = "Add to favorites"

// url you wish to have bookmarked
var url = "http://www.sindoe.dk/html/java_code_e.html";

// caption to appear with bookmark
var who = "Rolf Sindø - java codes";

// do not edit below this line
// ===========================

var ver = navigator.appName
var num = parseInt(navigator.appVersion)
if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
   document.write('<A class="morehl" HREF="javascript:window.external.AddFavorite(url,who);" ');
   document.write('onMouseOver=" window.status=')
   document.write("txt; return true ")
   document.write('"onMouseOut=" window.status=')
   document.write("' '; return true ")
   document.write('"<a>'+ txt + '</a>')
}else{
   txt += "  (Ctrl+D)"
   document.write(txt)
}
</script>

Back to page overview

Opdateret d. 27.10.2010