help for popup script

Status
Not open for further replies.

Sahibaan

Active Member
134
2010
11
100
hi everyone. i need some help.. i want to create a script of popup of new windows.. this script i use on my site... i want any member when visit on my site this popup auto show in new tab windows please help me...
 
15 comments
@Apathetic - great name matches your essence of being.


@Sahibaan
Code:
<html>
<head>
<script type="text/javascript">
<!--
function myPopup() {
window.open( "http://www.youraddress.com/" , "myPopupWindow")
}
//-->
</script>
</head>
<body onLoad="myPopup()">
//
Your html
//
</body>
</html>
 
Last edited:
is there a code which does the following ?
When a user randomly clicks anywhere on a site, and he gets a pop up loaded on a new tab instead of a new window.

 
Use window.onclick function to fire a event whenever someone clicks on the page and then use window.open('http://google.com/myurlhere','_newtab'); to open a link in new tab
 
@Apathetic - great name matches your essence of being.


@Sahibaan
Code:
<html>
<head>
<script type="text/javascript">
<!--
function myPopup() {
window.open( "http://www.youraddress.com/" , "myPopupWindow")
}
//-->
</script>
</head>
<body onLoad="myPopup()">
//
Your html
//
</body>
</html>

i put it in footer but not work.
 
How to Add Pop-up Windows to Your WordPress Posts

Step 1

You need to add thickbox to your WordPress post. You can do this by adding the add_thickbox function to the ‘init’ function of your theme. In particular, add the code below to your theme functions.php file.

PHP:
<?php
add_action('init', 'init_theme_method');
 
function init_theme_method() {
   add_thickbox();
}
?>


Step 2

Now we can just add the button right in our post and link it to thickbox by specifying class=thickbox. Click on the HTML tab in your post editor and paste the HTML code below into your post.

PHP:
<div style="text-align:center;padding:20px;"> 
<input alt="#TB_inline?height=300&amp;width=400&amp;inlineId=examplePopup1" title="add a caption to title attribute / or leave blank" class="thickbox" type="button" value="Show Thickbox Example Pop-up 1" />  
</div>


Step 3

Finally, we specify the content that goes into our pop-up window by creating a div with id=examplePopup1.

PHP:
<div id="examplePopup1" style="display:none">
<h2>Example Pop-up Window 1</h2>
<div style="float:left;padding:10px;">
<img src="http://shibashake.com/wordpress-theme/wp-content/uploads/2010/03/bio1.jpg"  width="150" height = "168"/>
</div>
I was born at DAZ Studio. They created me with utmost care and that is why I am the hottie that you see today. My interests include posing, trying out cute outfits, and more posing.
 
<select name=""><option>test</option></select>
 
<strong>Just click outside the pop-up to close it.</strong>
</div>


And just like that, you have your pop-up window.
 
Status
Not open for further replies.
Back
Top