Friday, August 7, 2009

Not IE, please...

isIE = (document.all) ? true:false;

Short and sweet!

Friday, May 15, 2009

Non-JavaScript users can ignore the script and follow the link:

<a href="ajax.htm?foo=32" onClick="navigate('ajax.html#foo=32');
return false">foo 32</a>

Thursday, March 26, 2009

bookmark this page

This JavaScript along with the anchor tag allow you to create a quick and easy way to help your viewers bookmark your page.
Click to bookmark this page

<script type="text/javascript">
function favs() {
if ( navigator.appName != 'Microsoft Internet Explorer' ) {
window.sidebar.addPanel(
"Google","http://www.google.com","");
} else {
window.external.AddFavorite(
"http://www.google.com","Google");
}
}
</script>

<a href="javascript:void(favs());">
Click to bookmark this page</a>

Friday, March 6, 2009

JavaScript to disable cut and paste into form fields

// JavaScript to disable cut and paste into form fields

function cutNPasteNot(evt) {
    document.body.ondrag = function () { return false; };
    document.body.ondrop = function () { return false; };
    document.body.oncopy = function () { return false; };
    document.body.onpaste = function () { return false; };
}

Another W3C valid snippet to replace target=...

<a id="sage" href="http://www.sagewebsitedesigns.com/"
    title="Site by Sage Website Designs"
    onclick="window.open(this.href);
    return false;">Sage
</a>

Or, how about:

onclick="return !window.navigate(this.href)"

which will open the new page in the same window...

W3C valid swf embedding

W3C valid swf embedding

<object type="application/x-shockwave-flash"
    data="/flash/sageAdBox.swf"
    width="264" height="180">
    <param name="movie" value="../flash/sageAdBox.swf" />
</object>

From an article in A List Apart Flash Satay