pop-up scripts
Below you'll find several
cut and paste pop-up scripts,
together with instructions on how
to put the javascript on your site
and modify the pop-up
code.
pop-up script to
open a window when your page
loads
Place the following script between
the <HEAD>
and </HEAD>
tags:
<script
language="javascript">
<!-- begin
function popup(Site)
{
window.open(Site,'PopupName','toolbar=no,statusbar=no,
location=no,scrollbars=yes,resizable=yes,width=275,height=200')
}
// end -->
</script>
onLoad="popup('URL/to/popup.html')"
Your
<BODY>
tag should then look something
like this:
<BODY
bgcolor="#ffffff"
text="#000000"
onLoad="popup('http://NowSell.com/popup.html')">
as you prefer (or
omit them), and set the width and
height to the size you require.
second on entry
pop-up script
example
Place the following script between
the <HEAD>
and </HEAD>
tags:
<script
language="javascript">
<!-- begin
function popup(){
window.open('URL/to/popup.html','PopupName','toolbar=0,location=0,
status=0,menubar=0,scrollbars=0,resizable=0,width=345,height=400');
}
// end -->
</script>
Add the following
code into your <BODY>
tag:
onLoad="popup()"
Your
<BODY>
tag should then look something
like this:
<BODY
onload="popup()"
bgcolor="#ffffff"
text"#000000">
third on entry
pop-up script
example
Place the following
script between the <HEAD>
and </HEAD>
tags:
<script
language="javascript">
<!-- begin
function popup() {
var page = "URL/to/popup.html";
var windowprops =
"width=380,height=500,location=no,menubar=no,
toolbar=no,scrollbars=no,resizable=no";
newWindow =
window.open(page,'PopupName',windowprops);
}
// end -->
</script>
Add the following
code into your <BODY>
tag:
onLoad="popup()"
Your <BODY>
tag should then look something
like this:
<BODY
onload="popup()"
bgcolor="#ffffff"
text"#000000">
code to close
pop-up after a certain
time
Add
the following code to your
pop-up script, and adjust
the time (in seconds) to
your requirements:
setTimeout
('self.close' ()',
1200);
code to open your
pop-up with a
link
Place the
following code where you want the
link to appear:
<a
href="javascript:popup()">Click
here for
pop-up</a>
code to open your
pop-up with a
button
Place the
following code where you want the
button to appear:
<FORM>
<input type="button"
value="Click Me"
onClick="javascript:popup()">
</FORM>
code to create a
"close window"
button
Place the
following code where you want the
buton to appear:
<FORM>
<input type="button"
value="Close Window"
onClick="window.close();">
</FORM>
