GetDotted Domains

Viewing Thread:
"Simple POPUP Window using JavaScript."

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Thu 30/04/09 at 12:45
Moderator
"Are you sure?"
Posts: 5,000
JavaScript popup windows

It's often useful to open up a 'popup' window rather than take your visitors to a new page - great for displaying information quickly.

To create a simple popup window you need just two small bits of code.

1) JavaScript

Insert the following in the page :


<script type="text/javascript">
<!--function myopen(filename,windowname,properties) {
mywindow = window.open(filename,windowname,properties);}// -->
</script>


2) The LINK

Then all you need to do is create a link on your page to open the popup window.

Use the following code - just change the www address as required. The other options are mostly self-explanatory, all can be left as they are, but you might need to change the width and height, this will be the size of your popup - so it needs to be the right size for your content:


<a href="javascript:myopen ('http://www.yourwebiste.com/popup.htm', 'fgpopup',
'toolbar=no,location=no,directories=no,status=no,
menubar=no,scrollbars=yes, resizable=no,copyhistory=no,
width=400,height=300')" >Click to open Popup Window</a>



You're finished now, you can have as many 'popups' on a page as you like - just repeat the LINK code you only need the JavaScript once.

CLOSE link
...it's often useful to create a 'CLOSE' link on the popup window.

All you need to do is add this snippet:

<a href="javascript: window.close();">close window</a>



Another useful tip to help you find out how things work is to view the 'page source' which shows you the code. When you are on a site and like the way something works, try working it out by reading the code and copying/pasting. You can build a useful collection for your website building!
The observant will see that I've worked all this out from Freeola's own pages - the 'View the winners list' link on the left :¬)

Demo created here: Simple JavaScript popup window



Search Freeola Chat
Thu 30/04/09 at 15:48
Regular
"Devil in disguise"
Posts: 3,151
Popups are the work of the devil!
Thu 30/04/09 at 14:05
Moderator
"Are you sure?"
Posts: 5,000
Thanks pb :¬)

It's surprising what you can cobble together when you try and nice that many things, like 'popup windows' can be re-used on others sites etc.







Search Freeola Chat
Thu 30/04/09 at 13:31
Moderator
"possibly impossible"
Posts: 24,985
I like that. I'm keeping a note of all your web tips for when I get my Freeola site (should be getting some agreement on helping finance it soon). Things like this will be useful in making it look more professional.
Thu 30/04/09 at 12:45
Moderator
"Are you sure?"
Posts: 5,000
JavaScript popup windows

It's often useful to open up a 'popup' window rather than take your visitors to a new page - great for displaying information quickly.

To create a simple popup window you need just two small bits of code.

1) JavaScript

Insert the following in the page :


<script type="text/javascript">
<!--function myopen(filename,windowname,properties) {
mywindow = window.open(filename,windowname,properties);}// -->
</script>


2) The LINK

Then all you need to do is create a link on your page to open the popup window.

Use the following code - just change the www address as required. The other options are mostly self-explanatory, all can be left as they are, but you might need to change the width and height, this will be the size of your popup - so it needs to be the right size for your content:


<a href="javascript:myopen ('http://www.yourwebiste.com/popup.htm', 'fgpopup',
'toolbar=no,location=no,directories=no,status=no,
menubar=no,scrollbars=yes, resizable=no,copyhistory=no,
width=400,height=300')" >Click to open Popup Window</a>



You're finished now, you can have as many 'popups' on a page as you like - just repeat the LINK code you only need the JavaScript once.

CLOSE link
...it's often useful to create a 'CLOSE' link on the popup window.

All you need to do is add this snippet:

<a href="javascript: window.close();">close window</a>



Another useful tip to help you find out how things work is to view the 'page source' which shows you the code. When you are on a site and like the way something works, try working it out by reading the code and copying/pasting. You can build a useful collection for your website building!
The observant will see that I've worked all this out from Freeola's own pages - the 'View the winners list' link on the left :¬)

Demo created here: Simple JavaScript popup window



Search Freeola Chat

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Very pleased
Very pleased with the help given by your staff. They explained technical details in an easy way and were patient when providing information to a non expert like me.
Just a quick note to say thanks for a very good service ... in fact excellent service..
I am very happy with your customer service and speed and quality of my broadband connection .. keep up the good work . and a good new year to all of you at freeola.
Matthew Bradley

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.