Articles | Odds and Sods back 

Frames

To remove frames:

<a href="http://www.yahoo.com" target="_top">
Remove Frames</a>

To check if the current document is loaded in a frame:

<body onLoad="if (parent.location.href != self.location.href)
    {... do something ...}; return true;">

To change the contents of two or more frames:

<a href="JavaScript:jump()">Change Frames</a>

<script language = 'JavaScript'><!--
function jump() {
    parent.frame1.location.href = 
    'http://www.yahoo.com';
    parent.frame2.location.href =  
    'http://www.altavista.digital.com/';
}
//-->
</script>

Mailto

The following mailto attributes do not currently work with Internet Explorer:

Dates

To reformat the last modified date:

<script language="JavaScript"><!--
function makeArray0() {
     for (i = 0; i<makeArray0.arguments.length; i++)
          this[i] = makeArray0.arguments[i];
}

var days = new makeArray0("Sunday","Monday","Tuesday","Wednesday",
    "Thursday","Friday","Saturday");

var months = new makeArray0('January','February','March',
    'April','May','June','July','August','September',
    'October','November','December');

function nths(day) { 
     if (day == 1 || day == 21 || day == 31)
          return 'st';
     else
          if (day == 2 || day == 22)
               return 'nd';
               if (day == 3 || day == 23)
                    return 'rd';
               else return 'th';
}

function y2k(number) { return (number < 1000) ? number 
+ 1900 : number; }

var last = document.lastModified;
var date = new Date(last);
document.write("Last updated on " + days[date.getDay()] + ' ' +
    date.getDate() + nths(date.getDate()) + " " +
    months[date.getMonth()] + ", " +
    (y2k(date.getYear())) + ".");
//--></script>

Which produces:

Last updated on Tuesday 1st May, 2001.

Refresh

To refresh the current page 10 seconds after it has loaded:

<body onLoad="window.setTimeout('RefreshScreen()',10000)">

<script language="JavaScript"><!--
function RefreshScreen()
{
     location.href = self.location.href;
}
//--></script>

Or:

<body onLoad="window.setTimeout('RefreshScreen()',10000)">

<script language="JavaScript"><!--
function RefreshScreen()
{
     history.go(0);
}
//--></script>

Alternatively use the following in the HEAD section:

<META HTTP-EQUIV="Refresh" CONTENT="10">

Articles | Odds and Sods back

 

Menu

Home
Articles
FAQ's
Links
Tools
Blog Links
AJAXCoded Blog
CyberCoded.net
CyberCoder
CybersView

Applications

 

Questions, Comments
or Suggestions

Site Search
FAQ Search

AJAX Coded
CAAD @ CyberCoded.net


 

Copyright


Google
WWW CyberCoded.com
Provide Feedback on CyberCoded.com

Copyright © 1996-2008 CyberCoded.com, All Rights Reserved.
CyberCoded.com liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public privacy statements.
Website Hosted By: USNX

We recommend USNX for quality ASP Web Hosting