Java and other Html Goodies

I am not a large Fan of too much Java and such... as it can slow a web site wayyyyy down..
however there are a few scripts I feel worth sharing, they are little things, snippets they are called,
but oh so handy and believe it or not , were fairly hard to find.
Finding ones that will do everything but make the coffee, are easy.
Simple , but useful things like these.. came harder

Any that contain an authors name.. please be sure to leave that information
I use these myself and they do work for me.

If you have any little goodies like this.. Let me know...:)

More will be added , as I find them and use them myself
Then after a bit of field testing, they will end up here
Enjoy

Disclaimer: I did not write these, I do use them , but make no claims on them
I just put them here for you , as accurately as possible......with the same directions as were given me
make of them what you will , use at your own risk.


Force a new window to open ?

This, placed in the header tag, will do that for every link on the page.
Very good to add to a page you have a no-right-click on..
so they can still easily surf the links, without having
to go back and forth like a yo yo
and reload the page over and over...
Do warn the viewer that links will open in a new window
Works 99% of the time, some configurations subvert this
but nothings perfect
................................................................................................................................................................

<base target="main">
Don't want that oh so helpful copy,
email image, steal me now, I.E. bar to show up
when they hover over an image ?
Plant this in the meta tags
and kiss it good-bye
<meta http-equiv="imagetoolbar" content="no">
Have a long page and don't want your viewer
to have to scroll their life away ?

Stick this anywhere, using any font, size , colors and text,
you prefer and it will shoot them
right up to the top of the page
with a click of a mouse on the link

<b><font face="Papyrus"><font color="#FF99FF"><font size=+1><a href="#top">Back
to top</a></font></font></font></b>
Someone drag a frame set in with with them ?

Park this just under the head tag of your page
and break it automatically.
No buttons to push

<!-- Begin
if (window != top) top.location.href = location.href;
// End -->
</SCRIPT>
Want to have some trippy fade ins and out
instead of the plain ole boring stuff
when the page loads ?

The time set can be changed to whatever you want but can have major effects on the display,
so its best to leave it just as it is, it will randomly go thur 23 different ways to open a web
page each time it's loaded



You can do one for in, and one for out.. if you like
play with it .... works only in IE
This one is my personal fave

Place it in the meta tags,
Note: opening a new window negates this effect

<meta http-equiv="Page-Enter" content="revealTrans(duration=2, Transition=23)">
 



<meta http-equiv="Page-Enter" content="BlendTrans(Duration=1.5)">
<meta http-equiv="Site-Exit" content="BlendTrans(Duration=1.5)">
Hate it when you make a table
and the cells close because they are empty
so ya have to put more images in... just to keep them open...?

Well no more.. just this  &nbsp; space marker
in between the td and /td markers
and the cells stay open with nothing
showing to the viewer..
and no extra load time for images. Later,
when you go back and put in an image
or text, be sure to remove the placeholder first.

<TABLE BORDER CELLPADDING="4">
<TR>
<TD>Your Text</TD>
<TD>&nbsp;</TD>
<TD>Your Text</TD>
</TR>
<TR>
<TD>&nbsp;</TD>
<TD>Your Text</TD>
<TD>&nbsp;</TD>
</TR>
</TABLE> 
Have Java running on your page, that's not yours..? Like ad banners
and the page load slows way down due to their errors
or worse.. stops
because of their errors.....?

NO more.. park this between the head and end head tags
and bye bye hang time thats no fault of yours
it will even stop such errors if its your own codes doing it

<script language="JavaScript">

// Source: CodeFoot.com

function blockError(){return true;}

window.onerror = blockError;

</script>

Bookmark Me ?
Replace UrL, page name, font face ,
size and color with your information,
and put it anywhere between the
body and body tags that
you want it to show up.

If ya dont change it, they will be
bookmarking me, not that I mind,
but that wont help you a bit :)

<script language="JavaScript">
<!--
var bookmarkurl="http://paganart.dreamdivining.com"
var bookmarktitle="Pagan Art work From Pagan and Proud"
function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}
-->
</script>
<b><font face="Copperplate Gothic Bold"><font color="#FFFFFF"><a href="javascript:addbookmark()">Add
to Bookmarks</a></font></font></b>
Print this page ? Put this just below
the first body tag
It uses your default font size and colors
And all they do is click and it
pulls up their print comands.
<center><a href="javascript:;" onClick="window.print();return false"><b>Print
this page</b>.</a>
Update your copyright
Park between the body tags where ever you want it to show and it will update the copyrite information, year by year automaticly
Change the text if you want, but this is the accepted format
great for at the bottom of the page... its a set and forget it
<p><script language = 'JavaScript'>
<!--
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
var today = new Date();
var year = y2k(today.getYear());
document.write(' '+year+' all rights reserved');
//-->
</script>
This rather massive puppy
is for when did you update the page last.
In exacts for day, mt and year
<center>
<p><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';
if (day == 2 || day == 22) return 'nd';
if (day == 3 || day == 23) return 'rd';
return 'th';
}
function getCorrectedYear(year) {
year = year - 0;
if (year < 70) return (2000 + year);
if (year < 1900) return (1900 + year);
return year;
}
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
function padout(number) { return (number < 10) ? '0' + number : number; }
var last = document.lastModified;
var date = new Date(last);
var dateY2K = new Date(getCorrectedYear(date.getYear()),date.getMonth(),date.getDate());
document.write('Last Modified: '+ days[dateY2K.getDay()] + ' ' +
dateY2K.getDate() + nths(dateY2K.getDate()) + " " +
months[dateY2K.getMonth()] + ", " +
(y2k(dateY2K.getYear()))
);
//-->
</script>
</center>
Cute little CSS style goodie for making links have a bar of color behind them when the mouse hovers over them.. with no images.... :)

place in the head section, under the title tag works fine, change the color to what works best with your links and wa la, a decent attention getter for where your links are... with a very tiny footprint of space, works only for text links and plays well with most other scripts

<style>
<!--
a:hover {background-color:#7b05ff}
//-->
</style>
Make your own welcome to our world message in the browsers status bar
This one is real simple, put it anywhere in the body.. down at the bottom of the page works fine.. change the message, being sure to change only the text, nothing else, to say whatever you want it to say, and unless the mouse is over a link, it will stay there in the status bar.... no movements or jumping about, just a simple hello :) or whatever else you want .. easy to change.. just change the message.. have sales going on.. or speicals, need to place an adults only warning ? the uses are endless, in a simple, not likely to break down form, that plays well with other scripts
<script language="JavaScript">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

function text(txt) {
window.status = txt;
}
// -->
</script>
<body onLoad="text(' Whatever you want it to say ');">

Email Me with questions or problems getting these to work
I will try to help as best I may

Return to How to Design a website

or

Home