GOD HELP ME WITH JAVASCRIPT

We may earn a small commission from affiliate links and paid advertisements. Terms

reikoshea

HS Troll...And Mod
Moderator
VIP
okay, so my boss decides to promise a dealership (yes im a graphic artist for an automotive ad firm) that we can have their e-mail ad campaign up and running by May 1st.

Cool, i can do that...but what she told me today was that i need to have a small version of the ad in email (not a problem) and then a larger version pop up in a fixed window once anything is clicked (ad not a problem, pop up HUGE FRIGGIN PROBLEM).

So i get everything ready with a normal link that opens a window that opens another window (onLoad) and then the child window closes the parent. No biggie. I upload to the server and guess what happends....GOOGLE POP UP BLOCKER...YAHOO POP UP BLOCKER and FIREFOX all kill my ad. So, its back to the drawing board on something i thought would be easy.

Code:
<script language="Javascript">
var the_timeout;
function doTimer()
{
the_timeout = setTimeout("document.forms.redirect.submit();", 3000);
}
function newWindow(newContent)
 {
winContent = window.open('http://www.reikoshea.com/Work/Classic-TahoeAdFinished.html', 'nextWin', 'left=35,top=0,width=956,height=716,toolbar=no,scrollbars=no,resizable=no') 
 }
 function init()
{
doTimer();
}
window.onLoad = init;
</script>
<script LANGUAGE="VBScript">
Sub Window_Onload
window.opener = "x"
End Sub
</script>

</head>

<body>
<form onSubmit="newWindow();" name="redirect">
</form>
</body>
</html>

That just sends my browser into an endless loop, but i think im close. anyone know anything that might help me out in keeping this project alive?
 
Wait... So you want to create a Popup that isn't going to be blocked by popup blockers?
 
its not a pop up technically...the user clicked and wants more info, im giving it to them in a sized window. thats my goal, but this is an email, and sized windows dont go well with emails.
 
I dont understand the timeout, but if they need to click anyways define the link>
This code works in ie7.
Code:
<script language="Javascript">
function poop(){
window.open('http://www.reikoshea.com/Work/Classic-TahoeAdFinished.html', 'nextWin', 'left=35,top=0,width=956,height=716,toolbar=no,scrollbars=no,resizable=no') 
}
</script>
<a href="#" onClick="poop();">.</a>
Stay away from VBScript for any reason if possible, FF doesn't support it.
 
bro, believe me if they could click twice i would have done it already. the customer wants that window up in one click, they dont want another link to click. this HAS to load with the one interaction in the e-mail (meaning i cant use JS) and then from there i can do whatever it takes for that window to end up on their screen, in a fixed pop up like window (no scroll no menu no nothing)
 
I'm lost i guess?
They can just click one time to get that window open?
Or do you mean they need to click a link to the page, and that needs to make the popup?
 
javascript as a popup might work, but in my case were I block javascript I'll never see it.
 
it starts out as an e-mail...from the email i need an ad. something like a window.open like above, but it just doesnt work in e-mails.
 
also keep in mind you're sending an email , which in fact is not a web browser, so a window.open call in javascript from a mail client might not open a "web browser" windows.

also keep in mind many spam blockers junk mail with html and javascript so the effectivness of this ad might be degraded.

just some food for thought.
 
how about using an absolute positioned div?
you can fake it to look like a pop up using DOM scripting.

similar to the my assistant "pop up". that is simply a div. it is not a popup.
 
Maybe give this a try:
Code:
<A HREF="java script:void(0)" ONCLICK="open('adpopup.htm','miniwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=750,height=600')" style="text-decoration: none">

set the href to the picture or whatever you want the user to click on. Set the adpopup.htm file to whatever you choose or set it to a hyperlink; http://www.kissmyass.com/adpopup.htm, etc. So the window will open with no scrollbars, etc ad to the size you request...

However, I really don't think it will work in email, but give it a try...

For some reason the code tag isn't recognizing an apostrophe after miniwin. Should be 'miniwin','toolbar
 
lol, thank you, thats what i was gonna ask. keepin me alive even while i work on the ads (my boss was wondering why i only have the one for the tahoe one finished...she didnt seem to understand how big of a problem this was).
 
if you can deal with having scrollbars, menu's & a status bar... you can just link the e-mail to your ad and resize the window to your specs in javascript once it's open. that way you'll be able to avoid pop up blockers and won't have to include javascript in an e-mail.

Code:
<html>
<head>
<title><!-- ad title here --></title>
<script language="javascript">
function resze() {
// change the width (800) and height (600) to your desired specs.
window.resizeTo(800,600);

if (self.innerWidth) {
frameWidth = self.innerWidth;
frameHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientWidth) {
frameWidth = document.documentElement.clientWidth;
frameHeight = document.documentElement.clientHeight;
} else if (document.body) {
frameWidth = document.body.clientWidth;
frameHeight = document.body.clientHeight;
} else return;

// anything "800" below, change to your desired width.
// anything "600" below, change to your desired height.
if(frameWidth < 800 || frameHeight < 600) {
newWid = 800 - frameWidth;
newHei = 600 - frameHeight;
newWid += 800;
newHei += 600;
window.resizeTo(newWid,newHei);
}

}
</script>
</head>
<body onLoad="java script:resze();">
<!-- ad content here -->
</body>
</html>
edit: take the space out of "java script" in the onLoad function in the body tag. i don't know why it's there... the forum put it there.
 
Back
Top