JavaScript Snippets – Link Magic
Some of the Neat Little Tricks You Can Do With JavaScript Links
May 10, 2010 Categories: Internet Marketing, Scripts & Tools, Web Design
Open a new window with a link
Between Head Tags:
<Script>
function load() {
var load = window.open('http://www.domain.com','','scrollbars=no,
menubar=no,height=600,width=800,resizable=yes,toolbar=no,
location=no,status=no');
}
</Script>
Your Link:
<a href="javascript:load()">Open Window</a>
As you can see in the code example above, you can control a some attributes of the new window. You would replace http://www.domain.com with your own link. Then you can decide the hieght and width of the new window and whether or not the user can resize it (yes/no), if it shows the scrollbars or if the browser toolbar and menu bar should show.
Close a Window With A Link
<a href="javascript: self.close()">Close Window</a>
Reload a Window With A Link
<a href="javascript: window.location.reload()">Reload Window</a>
Go Back 1 Page With A Link
<a href="javascript: history.go(-1)">Back</a>
Print Page
<a href="#" onClick="window.print()">Print Page</a>
Add To Favorites (Internet Explorer Only)
<a href="javascript:window.external.AddFavorite('http://www.yoursite.com',
'Your Site Name')">Add to Favorites</a>
Useful JavaScript Tools
——————————————————————————————
Better than Pop-ups, Pop-ins, and Pop-Unders
Optimize your advertising real estate and increase
ad conversions with Corner Stay Ads & Peel Away Ads
——————————————————————————————
Tags: JavaScript, Scripts, Web Design