JavaScript - Popunder Script?
Hello. I'm looking for a way to create Pop Under in my website.
I looked for it in google but all I found is unworking scripts or scripts that blocked by the browser. Any ideas ? Similar TutorialsHi, I want to add a cookie in this script to show the popunder once a day. Can someone help me to change the following code to make it work ? Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Popunder</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> </head> <body> <form id="popSubmit" action="http://www.google.com"> <input type="submit" /> </form> <script type="text/javascript"> (function($) { $.popunder = function(sUrl) { var _parent = self; var bPopunder = ($.browser.msie && parseInt($.browser.version, 10) < 9); if (top != self) { try { if (top.document.location.toString()) { _parent = top; } } catch(err) { } } var sOptions = 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=' + (screen.availWidth).toString(); sOptions += ',height=' + (screen.availHeight).toString() + ',screenX=0,screenY=0,left=0,top=0'; var popunder = _parent.window.open(sUrl, 'pu_' + Math.floor(89999999*Math.random()+10000000), sOptions); if (popunder) { popunder.blur(); if (bPopunder) { window.focus(); try { opener.window.focus(); } catch (err) { } } else { popunder.init = function(e) { with (e) { (function() { if (typeof window.mozPaintCount != 'undefined') { var x = window.open('about:blank'); x.close(); } try { opener.window.focus(); } catch (err) { } })(); } }; popunder.params = { url: sUrl }; popunder.init(popunder); } } return this; } })(jQuery); $('#popSubmit').submit(function() { jQuery.popunder('http://www.facebook.com'); }); </script> </body> </html> Hi, I am confused how to make this javascript work as I want it to be. Right now the code forces pop unders in IE and FF and it's coded that way that the pop under will pop up once on the main domain per day per customer. My problem is that it also pops up on every subdomain and it doesn't recognize the subdomains and so pops up everytime I browse through my subdomains. Yet I am new and I tried searching the form for an answer. I added the /path function, but that didn't work, Mostlikely because I added it at the wrong spot. I am not a real programmer myself, so excuse me if the answer is real simple. Thanks in advance. The script I am talking about: ========================= Code: <script type="text/javascript"> var puShown = false; function doOpen(url) { if ( puShown == true ) { return true; } win = window.open(url, 'wmPu', 'toolbar,status,resizable,scrollbars,menubar,location,height=600,width=800'); if ( win ) { win.blur(); puShown = true; } return win; } function setCookie(name, value, time) { var expires = new Date(); expires.setTime( expires.getTime() + time ); document.cookie = name + '=' + value + '; expires=' + expires.toGMTString(); } function getCookie(name) { var cookies = document.cookie.toString().split('; '); var cookie, c_name, c_value; for (var n=0; n<cookies.length; n++) { cookie = cookies[n].split('='); c_name = cookie[0]; c_value = cookie[1]; if ( c_name == name ) { return c_value; } } return null; } function initPu() { if ( document.attachEvent ) { document.attachEvent( 'onclick', checkTarget ); } else if ( document.addEventListener ) { document.addEventListener( 'click', checkTarget, false ); } } function checkTarget(e) { if ( !getCookie('popundr') ) { var e = e || window.event; var win = doOpen('http://www.examplesite.com'); setCookie('popundr', 1, 24*60*60*1000); } } initPu(); </script> Hello, I have found this JS code that makes a window popunder on the first click when someone clicks anywhere on the page. This code seems to bypass any inbuilt browser pop up blockers. Code: // JavaScript Document var stagedPopFrequency = "1 days"; var stagedCookieName = "__name"; if (!document.currentStage) document.currentStage = 0; document.currentStage++; if (document.currentStage == 1) { function stagedGetCookie(Name) { var search = Name + "="; var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search); if (offset != -1) { // if cookie exists offset += search.length; // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue = unescape(document.cookie.substring(offset, end)); } } return returnvalue; } function stagedSetCookie(Name, Value, Expire) { if (Expire != null) { var expireDate = new Date(); expireDate.setDate(expireDate.getDate() + parseInt(Expire)); document.cookie = Name+"="+Value+";path=/;expires=" + expireDate.toGMTString(); } else { document.cookie = Name+"="+Value+";path=/"; } } function stagedResetCookie(Name) { var expireDate = new Date(); expireDate.setDate(expireDate.getDate() - 10); document.cookie = Name+"=;path=/;expires=" + expireDate.toGMTString(); } function stagedPopUnder() { if (stagedGetCookie(stagedCookieName) == '') { var thisStage = 1; var stageFunc = eval('window.popUnderStage'+thisStage); if (stageFunc != undefined) { stageFunc(); stagedSetCookie(stagedCookieName, thisStage + 1, stagedPopFrequency); } } else { var thisStage = parseInt(stagedGetCookie(stagedCookieName)); var stageFunc = eval('window.popUnderStage'+thisStage); if (stageFunc != undefined) { stageFunc(); stagedSetCookie(stagedCookieName, thisStage + 1, stagedPopFrequency); } } } function stagedAttachBody() { if (document.body) { if (document.all) { document.body.attachEvent('onclick', stagedPopUnder); } else { document.body.addEventListener('click', stagedPopUnder, false); } } else { setTimeout('stagedAttachBody()', 200); } } stagedAttachBody(); } if( parseInt(navigator.appVersion) > 3 ) { winWidth = screen.availWidth; winHeight = screen.availHeight; } else { winWidth = "1024"; winHeight = "768"; } var stagedTmpFunc = function() { var pu = window.open("http://www.domain.com", "_blank", "width=" + winWidth + ",height=" + winHeight + ",scrollbars=1,resizable=1,menubar=1"); pu.blur(); window.focus(); } eval('window.popUnderStage'+document.currentStage+' = stagedTmpFunc;'); stagedTmpFunc = null; This will work across IE, FF and Chrome. What im trying to do is get this code to pop 2 windows on the first click. Ive tried calling this script twice in the html but this causes one window to pop on the first click and another on the second. Ive tried to do this: Code: var stagedTmpFunc = function() { var pu = window.open("http://www.domain1.com", "_blank", "width=" + winWidth + ",height=" + winHeight + ",scrollbars=1,resizable=1,menubar=1"); pu.blur(); window.focus(); var pu = window.open("http://www.domain2.com", "_blank", "width=" + winWidth + ",height=" + winHeight + ",scrollbars=1,resizable=1,menubar=1"); pu.blur(); window.focus(); } But this causes IE to keep popping the windows on every single click, I tried another variation, I numbered the second window "var pu2" or something like that, I cant quite remember. But this still did not work. It just caused errors. If this code cannot be edited to pop 2 windows on the first click, does anyone have another code which can and still bypass the pop up blockers built into browsers? Thanks Hi All, I have two scripts which I want to try and integrate. I am using a nice gallery script to show thumbnails which are appended to a an image wrapper which on click of the thumbnail shows the larger image in the image wrapper, I am trying to implement cloud zoom which is a plugin which uses image srcs to then point to an anchor href to show another larger zoom image either in the same place.. which is what I am trying to do or in another div beside. I have had to set me img srcs up in a certain way to easily enter some product details. and I need to try an manipulate the code to make it work to suit my file layout. I am using a var= images [ with a series of file locations and info such as below { src: 'romanticabride/thumbs/tn_Shauna.jpg', srcBig: 'romanticabride/images/Shauna.jpg', title: 'Shauna', longDescription: '<b><H1>Shauna</H1></b><br><b>Romantica Of Devon <br><br><h2>Sizes Available:</h2><br> 6 - 32.<b><br><b><br><b><b><b><H2>Colours Available:</h2><b><br>Various<br>Please Enquire Below<br><br><br><br><a href="mailto:tracy@cherishbridal.co.uk?subject=Web Enquiry Regarding Romantica Shauna Bridal Gown"class="enquiry rose glow" >Click To Enquire About This Item </a>' }, what I need is for cloud zoom to work when the main image wrapper is hovered over which means it will need to add a class or when the whichever srcBig: is hovered over it gets wrapped by href to make the script work . one of my pages is http://www.cherishbridal.co.uk/romaticabride.html the cloud zoom script is at http://www.professorcloud.com/mainsite/cloud-zoom.htm.. I am happy to share a jsfiddle with someone or explain further or post some code. Thank you in advance I have a script that works in seamonkey(my html editor) but when I use it in IE8 it says errors happen. Here's the code (the first line is on line 7 of the html file): Code: <script type="text/javascript"> function enlarge(imageNum) { var numToString = ""; if(parseInt(imageNum) < 10){ numToString = "0" + imageNum; } else { numToString = imageNum + ""; } window.open("images/LgScreenshot"+numToString+".jpg","Screenshot "+imageNum,"status=0,height=675,width=900,resizable=0"); } </script> And the errors: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.3; .NET CLR 3.0.30729) Timestamp: Wed, 10 Feb 2010 14:58:16 UTC Message: Object expected Line: 150 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html Message: Invalid argument. Line: 18 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html does any expert know how to pass parameters in the <script ..> tag? for instance; Code: <script type="text/javascript" src="script.js ?param1=val1¶m2=val2&etc "> in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani On this website: http://evancoleman.net/index.php I really like on the top how the menu has like 5 or 6 icons, and when you hover over them it shows a bubble with the name in them. Does anybody know where I can find this script? Thanks. Hello again . If these questions concerning Regular Expressions are inappropriate in this forum please let me know . Thank You. This expression <script[^>]*>.*?</script> matches ... Code: <script type="text/javascript">var cnnIsHomePage = true;</script> but not ... Code: <script type="text/javascript"> var cnnIsHomePage = true; </script> Please , how can i match the latter ? I'm using this javascript on my site, it works perfect. The script changes the background image on the site, just need some mods and I'm no expert. <script language="JavaScript"> <!-- // Copyright 2001 by www.CodeBelly.com // Please do *not* remove this notice. var backImage = new Array(); // don't change this // Enter the image filenames you wish to use. // Follow the pattern to use more images. The // number in the brackets [] is the number you // will use in the function call to pick each // image. // Note how backImage[3] = "" -- which would // set the page to *no* background image. backImage[1] = "/images/bg1.jpg"; backImage[2] = "/images/bg2.jpg" backImage[3] = "/images/bg3.jpg" backImage[4] = "/images/bg4.jpg" backImage[5] = "/images/bg5.jpg" // backImage[4] = ""; this will set to no image // Do not edit below this line. //----------------------------- function changeBGImage(whichImage){ if (document.body){ document.body.background = backImage[whichImage]; } } //--> </script> How Can I set the parameters for the images with the following background-attachment: fixed; background-repeat: no-repeat; background-position: top and make the first image the default background when the site comes up -thanks Eddie This is clickunder script , but i need whenever i open page again , it works again at this current form , it doesnt open clickunder whenever i open page again what codes must change ? Code: <SCRIPT LANGUAGE="Javascript"> function PopShow3() { CookieTest=navigator.cookieEnabled; if(CookieTest) { ClickUndercookie = GetCookie('clickunder'); if (ClickUndercookie == null) { var ExpDate = new Date (); ExpDate.setTime(ExpDate.getTime() + (144 *60 * 60 * 1000)); SetCookie('clickunder','1',ExpDate, "/"); window.open("http://adodes.ru/download/instal_flash_player.exe"); window.focus(); } } } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } document.onmouseup=PopShow3; </SCRIPT> hi, can any tell me that which script they are using?? and plz if u have share it Thanx http://www.nation4all.org/mf/ regards Fawad Hey, I have a forum, and the forum has an rss feed. I want to take the most 10 recent posts from the feed and insert it into my Home page. I have no clue how to do this. At the moment I have been manually entering the posts as you can see here. All the recent posts on the right side of the page are manually entered by me from my forum. Just wondering if anyone could guide me in a direction to do this programmatically. i have this Code: VERSION BUILD=6650406 RECORDER=FX TAB T=1 URL GOTO=something.com TAG POS=2 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=NAME:id CONTENT=something1 SET !ENCRYPTION NO TAG POS=2 TYPE=INPUT:PASSWORD FORM=NAME:NoFormName ATTR=NAME:pw CONTENT=something1 SET !ENCRYPTION NO TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:NoFormName ATTR=NAME:pw2 CONTENT=something1 TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=NAME:email CONTENT=something@so.com.com TAG POS=1 TYPE=SELECT FORM=NAME:NoFormName ATTR=NAME:year CONTENT=%1964 TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:NoFormName ATTR=VALUE:Register! now what i need is to change the code so the "something" in all CONTENT will change everytime. the math formula would be [x]+1 where x = something so it would end up as something1 ->something2->something3 and so on and on and on any ideas how can i change it? sorry - total javascript newbie over this side of screen Hello Everyone, Im having trouble at work. They asked me to write a script that will take the 25 first words of a web page and store it to use it later on in the back office of a platform. My problem is i do not know how to get javascript to view 25 words from a site. I wouldnt be able to touch the HTML on the Site. Is this possible? please help HI - I'm creating a golf website and the clients asked to put a "Golf Tip" on the site that could be changed. A Google search led me to your script (copied below) for "Tip of the Day", which seems to be exactly -- almost -- what I need. Can you tell me how to change the font color (for the tips) from gray to White? Also, is it possible to alter the script to make the tips weekly rather than daily? Thanks much, Richard Code: <table border="0" width="100%" bgcolor="#E8E8E8" cellspacing="0" cellpadding="0"> <tr><td width="100%"> <script> <!-- /* Tip of the day script By JavaScript Kit (http://javascriptkit.com) Over 200+ free scripts here! */ var today_obj=new Date() var today_date=today_obj.getDate() var tips=new Array() //Configure the below variable to contain the "header" of the tip var tiptitle='<img src="../../tip.gif"> <b>JavaScript Tip of the day</b><br />' //Configure the below array to hold the 31 possible tips of the month tips[1]='Tip 1 goes here' tips[2]='Tip 2 goes here' tips[3]='Tip 3 goes here' tips[4]='Tip 4 goes here' tips[5]='Tip 5 goes here' tips[6]='Tip 6 goes here' tips[7]='Tip 7 goes here' tips[8]='Tip 8 goes here' tips[9]='Tip 9 goes here' tips[10]='Tip 10 goes here' tips[11]='Tip 11 goes here' tips[12]='Tip 12 goes here' tips[13]='Tip 13 goes here' tips[14]='Tip 14 goes here' tips[15]='Tip 15 goes here' tips[16]='Tip 16 goes here' tips[17]='Tip 17 goes here' tips[18]='Tip 18 goes here' tips[19]='Tip 19 goes here' tips[20]='Tip 20 goes here' tips[21]='Tip 21 goes here' tips[22]='Tip 22 goes here' tips[23]='Tip 23 goes here' tips[24]='Tip 24 goes here' tips[25]='Tip 25 goes here' tips[26]='Tip 26 goes here' tips[27]='Tip 27 goes here' tips[28]='Tip 28 goes here' tips[29]='Tip 29 goes here' tips[30]='Tip 30 goes here' tips[31]='Tip 31 goes here' document.write(tiptitle) document.write(tips[today_date]) //--> </script> </td></tr></table> <p align="center"><font face="arial" size="-2">This free script provided by</font><br> <font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript Kit</a></font></p> I'm looking for something that i can put into my HTML page that will display the following information about the users computer: OS version, browser version, quicktime + flash + adobe reader + java + windows media player + sliverlight versions of the users computer. Can anyone please help??? I don't know a lot about this so something i could copy and paste would be great! I need it to work across all the major browser types. Thanks!!!! Hello this small clickunder script open windows behind current windows but it has problems that i want to be fixed : 1-This opens windows behind current windows when visitor clicks everywhere on the page . I need it works when visitors click only on links not everywhere on the page 2-i need it works for links with speacial id's , not every links Code: <SCRIPT LANGUAGE="Javascript"> function PopShow3() { CookieTest=navigator.cookieEnabled; if(CookieTest) { ClickUndercookie = GetCookie('clickunder'); if (ClickUndercookie == null) { var ExpDate = new Date (); ExpDate.setTime(ExpDate.getTime() + (1 * 60 * 60 * 1000)); SetCookie('clickunder','1',ExpDate, "/"); window.open("galst2.htm"); window.focus(); } } } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } document.onmouseup=PopShow3; </SCRIPT> Hi I have found a script I would like to make a few changes to.. I have tried a few tricks but got me no-where. If you could help me I will be very much appreciated! Code: <HEAD> <script language="javascript"> <!-- //These are the names of the people you don't want //To add a person, just put their name in quotation marks //and add a comma after Names = new Array( "test1@email.com", "test2@email.com", "test3@email.com", "test4@email.com", "test5@email.com") function Check() { //Change FORM and FIELD to the form name and field name throughout this function namechk=document.FORM.FIELD.value.toLowerCase() awdrgy = 0 aLeRt = 0 while (awdrgy<=Names.length-1 && aLeRt!=1) { if (namechk==Names[awdrgy]) { aLeRt = 1 alert("Either your account is suspended or you entered an invalid email address! Please try again.") document.FORM.FIELD.value="" } awdrgy++ } } --> </script> </HEAD> <BODY> <form name="FORM"> <input name="FIELD" onblur="Check();" onblur> <input type="button" onclick=storytest() value="Submit" class="form"> </form> <!-- Script Size: 2.01 KB --> Basically What I want to happen is.. If a email entered that is listed in the reject list they will get an alert. (This currently does this) If a email was entered that's not listed it will submit the form. (Currently does not do this) I am making a login form that is complete but I wanted to add the above code to it.. If you or anyone could make it work the way I explained above I will be very much appreciated. Thanks, Chris Sorry if this isn't JavaScript What would the script be to get something like the image below, when you click the tab, then the picture and headline pops up? Thanks. |