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

Wednesday, March 4, 2009

JavaScript return false


<a href="#" onclick="func(); return false;">theLinkText</a>

The return false tells the browser that the action of returning
a reference to a
URL should not evaluate. It will instead, return
false
and therefore do nothing with the octothorpe (hey, how
often does one get to use that in a sentence?). This even
works in IE...

phpmailer and the various hosting companies

I've had pretty good results with phpmailer using php 4 and now using the php 5 version. I wasn't able to set it up on Sonic.net mostly because the client wouldn't pay for the time it would have taken to get it running on Sonic using their security setting.
Now I'm have some issues with the XO Communications hosting company. They use php 4 by default so I had to load the phpmailer for that version of php. The phpmailer seems to be working but I'm receiving this warning message: "
Warning: fsockopen() unable to connect to ... in /web/PHPMailer_v2.0.3/class.smtp.php on line 122"

March 23rd. Turns out that we don't have to use smtp at all. The phpmailer will deliver the email without any of the smtp, host, and password values used with smtp. On Yahoo's web hosting, they will only allow you script-generated email if the From address matches the address of the Yahoo account holder. Same goes for XO.