iFocus.Life News News - Breaking News & Top Stories - Latest World, US & Local News,Get the latest news, exclusives, sport, celebrities, showbiz, politics, business and lifestyle from The iFocus.Life,

Pop up ASP Javascript

101 8
There are a few different ways to code html popup window code. You may choose to code a popup window using javascript, dhtml, asp, or other programming language. If you are trying to retain visitors on your web site, then the best thing to do is to have a popup window pop in is BEFORE the visitor leaves your page, not after.

There is no way to accomplish this with current popup code, but there is a group that has made some software that will quickly create code that you can insert in any web site and it will function in a similar way.

I state similar because the popup is not seen by the browser as a html popup window; instead, it is seen as part of the original html page (or asp, php, coldfusion, dhtml, or other programming language page). By implementing this, the group has managed to create a popup so it is impossible to block by browers. This is just incredible to me.

It only took me looking at it one time to know that I had to have that piece of software. You can check out how it functions by visiting our full review on the program by clicking here to check out the html popup window code generating program. After you get to that page, pause about 5 seconds then push your mouse up near the back button on the web page ....... the on-page html pop up window slides in swiftly before you are able to the back button. Awesome!

I did not create this program. I am just a huge fan. I have been creating websites for over 10 years and do have my collection of code generators and snippets of my favorite code, but when I saw this I instantly fell in love with it!

If you still prefer to use the old fashioned popups, then the information below will help you out with doing that. There are some people that do not mind having a majority of their ads will be blocked; they just want a free solution for right now. I completely understand. In my early years of web site development I certainly would have thought before buying software to do anything similar to what I already know how to do.

OK, so here are some basics for newbies:
A popup window is a browser window that is smaller than standard pages and are usually without some standard browser features like tool bars, scroll bars or navigation buttons. Example, this link will open a medium-sized popup window. Pop up windows (aka popups) are frequently used to display special ads, small sidebar-style pages, or notices about something once you have left the main site.

Popup are one of the trickiest effects for web developers. More than one developer has been frustrated while trying to get popups to function properly. Furthermore, some abusive popup techniques have made many web pages non-functional and inaccessible by search engines.

Note, because I am writing actual within an article I am forced to spread the code out a bit. You should not do this in your actual web pages.

Surround this with the greater than and less than signs < >
SCRIPT TYPE="text/javascript"
function popup(mylink, windowname)

Surround this with brackets

if (! window.focus)return true; var href; if (typeof(mylink) == 'string') rel="nofollow" onclick="javascript:ga('send', 'pageview', '/outgoing/article_exit_link/1252165');" href=mylink; else rel="nofollow" onclick="javascript:ga('send', 'pageview', '/outgoing/article_exit_link/1252165');" href=mylink.href; window.open(href, windowname, 'width=400,height=200,scrollbars=yes'); return false;

Surround this with the greater than and less than signs < >
/SCRIPT

So lets look at exactly what has been done.

The code is javascript, so you must use the start and closing script tags for javascript.
Then, you add the name of the function (popup in this example), the link to the popup html page, and give it a window name.
Because the popup code has a unique name, you can call it anytime - when the page opens or closes, when someone clicks on it, virtually after any action you wish to associate with the function.

You can also modify the width and height of the popup as well as decide if you want scrollbars to be visible. Those are the most used settings for popups.

Below is an example of how you can call that code snippet to action:

a rel="nofollow" onclick="javascript:ga('send', 'pageview', '/outgoing/article_exit_link/1252165');" href="/links/?u=popupfile.html" onClick="return popup(this, 'sample1')">my popup /a

The above code should be surrounded by <> around each of the a's.
sample1 = the name we gave to the popup window. So, make very sure you use that same name from our original javascript code (replace "windowname" with "sample1").

If you would like for the popups to be activated when a page is first loaded, then use the following code to launch the javascript.

Inside of the BODY tag, add:
BODY onLoad="popup('autopopup.html', 'ad')"

You see that a different html file is referenced in this instance and it has a unique name of ad.

One more key tip - Make sure the quotes and spacing are exactly as listed above or the link will function as a regular link.
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time
You might also like on "Technology"

Leave A Reply

Your email address will not be published.