Need help with simple javascript code

freechong

Newbie
Joined
May 9, 2009
Messages
35
Reaction score
1
Hi,

I am trying to make an image do two separate events in a wordpress post. The first, opens up an inpage popup using a plugin called Thickbox Content with a facebook share button. At the same time, a new window opens up and goes to my ad site. Can anyone help me fix this script? Thanks!


Code:
<script type="text/javascript">
function open_win() 
{
[thkBC height="225" width="490" anchortext="mysite" title="Share Us With Your Friends!"  url="mysite.com/share.php" type="iframe" html_wrap="p"];

window.open("mysite.com/ad.php" ta);
}
</script>

<form>
<a onclick="open_win()"><img src="mysite.com/myadpic"></a>
</form>
 
Oh okay so there is no possible way to make an image load that code and open a window to an ad?
 
yes it is possible, but I would recommend to use wordpress plugins that are designed for this thing instead of putting them to your wordpress loop.
 
Can you suggest any plugins that might do the trick? I would much rather do that.
 
Hey if you put this in your function it should create an iframe with the specs you have in the shortcode and append it to the body. if you want something to cover the rest of the screen you're going to need another element (should probably style it better as well), let me know if you need more help.

Code:
var popup = document.createElement('iframe');
popup.height = 225;
popup.width = 490;
popup.src = "siteUrl";
document.body.appendChild(popup);
 
Hey if you put this in your function it should create an iframe with the specs you have in the shortcode and append it to the body. if you want something to cover the rest of the screen you're going to need another element (should probably style it better as well), let me know if you need more help.

Code:
var popup = document.createElement('iframe');
popup.height = 225;
popup.width = 490;
popup.src = "siteUrl";
document.body.appendChild(popup);

While we appreciate your insight into a JS question, this is a 5 year old thread.
 
Back
Top