Tutorial Categories
» PHP
» PHP User System
» Web Development
» Javascript
» Cascading Style Sheets
» HTML
» Adobe Photoshop
» Adobe Dreamweaver
» Adobe Fireworks
» Microsoft Windows
» Microsoft Office
» Apple
» Linux
Partners
» How To Build A Solar Panel » Affordable Web Hosting » How to make a website » Tech Product Reviews » Web Hosting Reviews » Buy Website Traffic » Linux Training » Mac Pro Memory » Dating » EducationWarning: file() [function.file]: URL file-access is disabled in the server configuration in /home/techt/public_html/index.php on line 203
Warning: file(http://www.tucows.no/external.asp) [function.file]: failed to open stream: no suitable wrapper could be found in /home/techt/public_html/index.php on line 203
Warning: Invalid argument supplied for foreach() in /home/techt/public_html/index.php on line 205
1
Ok, so this simple tutorial is going to show you how to make a javascript popup window.
To start off lets start our code:
This tells the browser what type of code it is
This defines our function
This evaluates the code and prepares the window to open.
This decides if you want the toolbar to show in your popup window, 1 for yes 0 for no.
Do you want scroll bars? 1 for yes, 0 for no
Do you want to show the location (address bar)? 1 for yes, 0 for no
Do you want to show the status bar? 1 for yes, 0 for no
Show the menu bar? 1 for yes, 0 for no
Make it resizeable? 1 for yes, 0 for no
Width of the window in pixels
Height of window in pixels
Amount of pixels from the left hand side
Amount of pixels from the top, also closes our function
This ends our code.
So our final code is:
This code goes into the <head> section of your webpage.
There are two ways of opening your window, either by a text link or by a form button. Make sure this code goes into the <body> section of your website.
To open it via a form button use this code:
Make sure you edit page.html with the url of the page you want to opne in your popup window.
To open your popup window by a text link use this code:
Again make sure you edit page.html
Well thats our tutorial, hopfully now you will be able to make your own pop up windows.
To start off lets start our code:
<script language="JavaScript">
This tells the browser what type of code it is
function popUp(URL) {This defines our function
eval("page" + id + " = window.open(URL, '" + id + "', 'This evaluates the code and prepares the window to open.
toolbar=1,
This decides if you want the toolbar to show in your popup window, 1 for yes 0 for no.
scrollbars=1,
Do you want scroll bars? 1 for yes, 0 for no
location=1,
Do you want to show the location (address bar)? 1 for yes, 0 for no
statusbar=1,
Do you want to show the status bar? 1 for yes, 0 for no
menubar=1,
Show the menu bar? 1 for yes, 0 for no
resizable=1,
Make it resizeable? 1 for yes, 0 for no
width=500,
Width of the window in pixels
height=500,
Height of window in pixels
left = 390,
Amount of pixels from the left hand side
top = 150');");
Amount of pixels from the top, also closes our function
} </script>
This ends our code.
So our final code is:
<script language="JavaScript">
function popUp(URL) {
eval("page" + id + " = window.open(URL, '" + id + "', '
toolbar=1,
scrollbars=1,
location=1,
statusbar=1,
menubar=1,
resizable=1,
width=500,
height=500,
left = 390,
top = 150');");
}
</script>
This code goes into the <head> section of your webpage.
There are two ways of opening your window, either by a text link or by a form button. Make sure this code goes into the <body> section of your website.
To open it via a form button use this code:
<form>
<input type=button value="Open Popup" onClick="javascript:popUp('page.html')">
</form>Make sure you edit page.html with the url of the page you want to opne in your popup window.
To open your popup window by a text link use this code:
<a href="javascript:popUp('page.html')">Open Popup[</a>Again make sure you edit page.html
Well thats our tutorial, hopfully now you will be able to make your own pop up windows.
1