Tuesday, November 5, 2024

Quickie Popup Windows with JavaScript

Popup windows were the rage for years but are fast becoming extinct as popup blocker software franticly tries to eliminate this overly abused feature. It’s sad to think that a useful web feature that was utilized by millions of websites over the years for all the right reasons will someday be history. But that’s the web!

If you use popups, popunders or popexits on your site, you may want to warn folks before they click on a link or click out of your site. Why? Because the use of these features does not always reflect well on your business as they have developed a reputation of being sneaky. They can also easily be interpreted as being website spam especially when used in conjunction with advertising other websites.

If you do use popups, have a good reason to do so and keep your site visitors comfortable by forewarning them with a popup window icon next to the link. Feel free to use these two icons on your website.

A quick way to enable the popup feature on your website is to copy/paste the following JavaScript code between the HEAD tags of your web page that will contain the link to the page you want to popup. Adjust the width and height of the popup window as you wish. You can also change the ‘no’ properties to ‘yes’ if you want a status bar, toolbar, and menubar to display on your popup window.

<script language="javascript">
<!--
function basicPop(url) { newwindow=window.open(url, 'windownew',
'width=300,height=250,status=no,toolbar=no,menubar=no');
}
//-->
</script>

Now in your HTML source code place a # character for the normal link code and add the onclick code as shown below. Replace yourpage.html with the name of your page, of course.

<a href=”#” onclick=”basicPop(‘yourpage.html’)”>More Information</a>

BasicTemplates.com designs Website Templates with External CSS and has been providing webmasters worldwide with affordable template designs since 1994. BasicTemplates currently offers 650+ designs which may be purchased individually or get complete access to all templates via an affordable membership plan. Most templates were strategically designed with interchangeable graphics and elements to increase the potential number of design layouts for the end user. Each layout utilizes an external style sheet for easy site maintenance and to ensure fast page load.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles