JavaScript - Trying To Post A Php Array To A Popup In Ie
I've been trying to find a way of sending a large PHP array to a popup screen.
I got something working using GET variables in the URL but ran into the problem of the 2083 max URL length in IE. I therefore decided to try POST variables and came up the the method below. This seems to work fine with Forefox and Chrome; that is I get a popup window and the relevant POST variable. However it doesn't seem to work at all in IE8. I don't get a Popup window and there is no POST variable. Main Screen: popit.php <?php $pass = urlencode(serialize(array("key1"=>"value1","key2"=>"value2",0=>"value3","key4"=>999))); ?> <html> <head> <script type="text/javascript"> <!-- function popup(mylink, windowname, pass) { mypopup = window.open(mylink, windowname, 'width=390,height=390,scrollbars=yes'); mypopup.focus(); mypopup.document.write("<form name='myform' action='" + mylink + "' method='post'>"); mypopup.document.write("<input type='hidden' name='data' value='" + pass + "'>"); mypopup.document.write("</form>"); mypopup.document.close(); mypopup.document.forms.myform.submit(); return false; } //--> </script> </head> <body> <form> <table> <tr> <td> <a href="popup.php" onClick="return popup(this, 'test popup', '<?php echo $pass; ?>')">Click Here</a> </td> </tr> </table> </form> </body> </html> Popup Screen: popup.php <?php echo "\$_POST:<br>"; print_r($_POST); echo "<br><br>"; foreach($_POST as $key => $val) $$key = $val; echo "\$arr:<br>"; $arr = unserialize(urldecode($data)); print_r($arr); ?> Similar TutorialsHi, I'm kinda hoping this is possible but haven't found any reference to it... I have a parent page that opens a popup on click that launches a sidebar navigation on the right of the screen and resizes the parent page. What I am wanting to do is create a second popup (approx 250px high) that opens below the navigation (which is only around 600px high) but I have noticed that even when you have no status bar in the popup windows, they can still end up overlapping because of additional tools or plugins that the viewer has in their browser. Is there any way to get the popups to butt up against each other instead of overlapping? More like a relative popup? Any assistance would be appreciated. :-) I found this popup window, and it works for my project, now i would like to include a close option to the popup window. Either "close", a button, or click aywhere. Here is the coding I am currently using: <script type="text/javascript"> function openWin(image, w, h){ var wh='width='+w+',height='+h var tmpPage=window.open('','',wh) tmpPage.document.write('<body style="margin:0;padding:0;"><img src="'+image+'" width="'+w+'" height="'+h+'">') tmpPage.document.close() } </script> <a href="1379_files/image296.jpg" target="_blank" onclick="openWin(this.href, 1253, 940);return false;"><img src="1379_files/image296.jpg" width="348" height="261" border="0"></a> <a href="1379_files/image298.jpg" target="_blank" onclick="openWin(this.href, 1253, 940);return false;"><img src="1379_files/image298.jpg" width="348" height="261" border="0"></a> <p> <a href="1379_files/image300.jpg" target="_blank" onclick="openWin(this.href, 1253, 940);return false;"><img src="1379_files/image300.jpg" width="348" height="261" border="0"></a> This opens 3 pictures, that when clicked opens the popup of the same picture, only full screen. I am having a heck of a time closing this popup window when i logoff the site. i open it by Code: shoutwindow = window.open("<?=$MY_LINK_ROOT?>/shoutbox/minichat.php", "shoutwindow", "location=0,status=0,scrollbars=0,menubar=0,resizable=0 width=300,height=310"); when i click logoff the site i want the popup to close also here is the logoff php Code: session_start(); //only for testing will remove this if(!shoutwindow.closed) { echo "window open"; self.close(); //shoutwindow.close (); // also tried both these didnt work // window.close(); } else { echo "Window already closed"; } mysql_close($link); unset($_SESSION['Sess_UserId']); // Unset all of the session variables. session_unset(); // Finally, destroy the session. session_destroy(); echo "<script> location.href='$MY_LINK_ROOT'</script>"; exit; ?> what am i missing here lol ? thanks UPDATE: i just had an idea, can i mix a href and an onClick together so that both are executed like this (i never tried it before) Code: the reason i use self.close is because i heard that it always closes the child not the parent. <a href="logoff.php" onClick="self.close()" return:true;>Log Off</a> the return true will make it execute the href as well right? Hey everyone, I have a javascript problem which I think can be resolved by adding a few lines of code. I will try to explain my situation: Code: <img title='gameplay0001' class='popuplink' src="img/visual/gameplay/visual-gameplay-10.png"/>\ <span class='popup'> <span>gameplay0001</span> <img src="img/visual/gameplay/visual-gameplay-10_large.png" /> <div class='clear'></div> <div class='popupclosebtn'>back</div> </span> this javascript I wrote, allows me to do this: 1) I click on the element with class .popuplink 2) The span with the class popup that contains a span whose text equals the title of popuplink (in this case gameplay0001) appears 3) when I click popupclosebtn the popup closes this is all done by the next javascript: Code: $('.popuplink').each(function() { $(this).click(function() { var source = $(this).attr('title'); var popupContent = $(".popup:contains('" + source + "')"); var popupContainer = $("#popcontainerbase"); popupContainer.html(''); popupContainer.html(popupContent.html()); $("#popcontainerbase").fadeIn(200, function() { $('.popupclosebtn').click(function() { var popupContainer = $("#popcontainerbase"); popupContainer.html(''); $('#popcontainerbase').fadeOut(200, function() { }); }); $(document).keyup(function(e) { if (e.keyCode == 27) { var popupContainer = $("#popcontainerbase"); popupContainer.html(''); $('#popcontainerbase').fadeOut(200, function() { }); } }); }); }); }); Oh by the way, I put all the .popup content in a div called #popupcontainer, so my content won't affect my relative container div. So, this works perfect, text and images can be placed in the span .popup; no proplems. Additionally, I also have a jwplayer in my website. This works fine as well. With one exception: When I try to put a jwplayer video into a .popup window, IE fails to put the video in there. it just ignores it. My video popup page: Code: <img title='trailer01' class='popuplink' src="img/visual/trailer01.png"/> <span class='popup'> <span>trailer01</span> <div id="trailer01"> </div> <div class='clear'></div> <div class='popupclosebtn'>back</div> </span> The javascript source on the bottom of the page: Code: jwplayer("trailer01").setup({ controlbar:"over", "controlbar.idlehide": false, controlbar:"bottom", autostart: true, flashplayer: "jwplayer/player.swf", skin: "jwplayer/skins/glow.zip", wmode: "transparent", file: "video/trailer01.mp4", width: 490, height: 340 }); so, that is my situation. This script will not work in internet explorer. Can anyone tell me how to fix this? thanx in forward Okay, first it should be noted I am a complete, 100% neophyte with javascript. I know HTML code pretty well, and I can do quite a bit of PHP as well, but it is all self-taught, so I am hardly an expert... and as I said, java is like French to me. I have a very simple website I've built, nothing complicated or dynamic - but we want to add one feature to this website which I have to say I am at a complete loss about. Basically, I want to have the main page of this website to have a popup form that somebody can plug in their name, email and zipcode load the first time somebody loads the page (which would obviously dump into a database or something), and then the next time the person goes to that page, that popup does not come up again. In other words, I want the feature to behave exactly like this: http://gopleader.gov/ Grey out the background, popup form, place a cookie so that in the future the popup doesn't load again, and that is it. I honestly am no kidding when I say I don't know javascript at all... so I would appreciate somebody helping me out with that in mind (in other words, don't just assume I know where I need to input my own custom values). Does anyone have any ideas here? Is there a way to make a popup appear behind the current window?
Hello everyone, I need help to show popup only once a day per user! The Problem is that the users of my blog gets mad when the popup displays, so i only want to show it once a day. please add the codes to it fully and send it back over thanks! [CODE]<link href='http://pwnagesource.netii.net/java/jquery.fancybox.css' media='screen' rel='stylesheet' type='text/css'/> <!--[if lte IE 6]><link href="java/jquery.fancybox_ie.css" media="screen" rel="stylesheet" type="text/css" /><![endif]--> <script src='http://pwnagesource.netii.net/java/jquery-1.4.3.min.js' type='text/javascript'/> <script src='http://pwnagesource.netii.net/java/jquery.fancybox-1.3.4.js' type='text/javascript'/> <script type="text/javascript"> $j = jQuery.noConflict(); $j.fn.countDown = function(settings,to) { settings = jQuery.extend({ startFontSize: '14px', endFontSize: '14px', duration: 1000, startNumber: 10, endNumber: 0, callBack: function() { } }, settings); return this.each(function() { //where do we start? if(!to && to != settings.endNumber) { to = settings.startNumber; } //set the countdown to the starting number $j(this).text(to).css('fontSize',settings.startFontSize); //loopage $j(this).animate({ 'fontSize': settings.endFontSize },settings.duration,'',function() { if(to > settings.endNumber + 1) { $j(this).css('fontSize',settings.startFontSize).text(to - 1).countDown(settings,to - 1); } else { settings.callBack(this); } }); }); }; </script> <script type="text/javascript"> $j(function() { $j.fancybox( "<div style='margin-left: 20px;'></br><h3 style='background-color: #000; padding: 8px; color: white; text-shadow: white 1px 2px 2px;-moz-text-shadow: black 1px 2px 2px;-webkit-text-shadow: black 1px 2px 2px;font-weight: bold;font-family: \"Trebuchet MS\", Helvetica, Geneva, san-serif; font-size: 20px; '>TheEmoLab" | Subscribe To Our Newsletter!</h3><center></br><td align='left'> <p style='color:#666; font-style:italic; margin:0px 0px 5px 0px; '>Get Free Email Updates Daily!</p></td><form action='http://feedburner.google.com/fb/a/mailverify' class='emailform' method='post' onsubmit='window.open('http://feedburner.google.com/fb/a/mailverify?uri=theemolab/feed', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true' style='margin: 0pt;' target='popupwindow'><input name='uri' type='hidden' value='theemolab/feed'/><input name='loc' type='hidden' value='en_US'/><input class='mbttext' name='email' onblur='if (this.value == "") {this.value = "Enter your email...";}' onfocus='if (this.value == "Enter your email...") {this.value = ""}' type='text' value='Enter your email...'/><input alt='' class='mbtbutton' title='' type='submit' value='Submit'/></form></tr></tbody></table></center></br><hr style='padding-bottom: 0; margin: 0 0 7px 0;' /><p style='padding-bottom:0;text-align: center; font-weight: bold;margin-top: 0; padding-top:0;'>This dialog box will close in <span id='dialog_close_countdown'>30</span> seconds.</p></div>", { 'autoDimensions' : false, 'width' : 500, 'height' : 215, 'overlayOpacity' : '0.8', 'overlayColor' : '#000', 'onComplete' : function() { $j('#dialog_close_countdown').countDown({ startNumber: 30, callBack: function(me) { $j.fancybox.close(); } }); } }); }); </script>[ICODE] Hello all! I wanted to say hey as this is my first post! I will probably stick around for a little, but I need help first. I'm trying to make a code for something on a forum. It will prompt the user for a yes or cancel, then save a cookie with their answer. Then the next time the script is called, it will check for the cookie. If there is one saved, it won't prompt and use that value. Here's my breakdown (hope this is right) 1. Have a popup box that prompt for a 'yes' or 'cancel' Code: if(window.confirm("Use WHATEVER theme?")) { * * location.href = "URL HERE"; } Got that! 2. Save a cookie with the answer Here is where I need the help. I really don't have a clue other than the fact that you use setCookie(name, value, expire). I'm guessing that there will need to be something special in the value section. 3. When the script is loaded, it will check for the cookie saved and do whatever was saved Again, I need help. I know I'll need the getCookie function, but I dont know what else. As you can see, I'm rather hazy in the cookies department. If you ha any trouble and now understand it, please direct me to where you learned it as I am willing and wanting to learn this inportant function of JavaScript! I tried to provide as much detail as possible, but if you have questions ask! Any help would be greatly appreciated, whether or not it's the code I need. Whether it is direction or step by step help, I will still value it! Thanks! I am trying to have a photo gallery where you click on a thumbnail and it automatically changes the larger image in the cell next to it. That function is working. I am now trying to add a popup feature on the larger image that will pull an additional image and I cant seem to get it to work. In addition the text that appears under the large image is the same text no matter which image you click on. Please tell me what is wrong with my code...Thank you this is in the header function changeImage(filename,filename2,txt){ document.getElementById('mainimage').src=filename; document.getElementById('image2').src=filename2; document.getElementById('ImgTxt').innerHTML=txt; } function popUp(popupimage) { newwindow=window.open(popupimage,"name","height=500,width=500"); if (window.focus) {newwindow.focus()} return false; } This is in the body tag <table width="750" border="0" align="center" cellpadding="2" cellspacing="0"><tr bgcolor="#000000"><td valign="top" align="left" width="200" style="padding-top:20px"><img src="images/mini/bobov_reb_shloime_mini.jpg" alt="" class="thumb" onclick="changeImage('images/bobov_reb_shloime.jpg','images/originals/bobov_reb_shloime.jpg','Bobover Rebbe')" /><img src="images/mini/reb_svei_mini.jpg" alt="" class="thumb" onclick="changeImage('images/reb_svei.jpg','images/originals/reb_svei_mini.jpg','Reb Svei with Talmidim')" /><img src="images/mini/rogotchover_mini.jpg" alt="" width="63" class="thumb" onclick="changeImage('images/rogotchover.jpg','images/originals/rogotchover.jpg','Rogotchover')" /></td> <td align="center" valign="top" width="500" height="600" bgcolor="#000000" style="padding-top:20px;"><p><img src="images/bobov_reb_shloime.jpg" name="mainimage" width="424" border="0" id="mainimage" onClick="popUp(this.src)" /><br /><p> <span id="ImgTxt" class="text">Bobov Rebbe</span> </p></td></tr></table> hi currently i am using this to goto new page: Code: <div onClick="document.location='nextpage.html';" class="active">sometext</div> how can i make it a popup to that page if i click anywhere in the div, thanks for any help. Hi, Im new with java script. I have a doubt. Im building an html web site. How to create a image pop up while opening a page, with a close button. Pls anyone share the code. thanks Hi All How popup windows are made using Javascript? I am not talking about the popups cretaed using window.open. I am talking about the window which appears to display some advertisements in most of the sites. Charles Ok, I'm not a javascript expert, but I'm using a Drupal module called Calendar which uses some javascript to popup links in a DIV instead of going to a new page. This appears to work by adding class="popup" to links on the calendar. I want to use the same functionality to link to calendar events from other areas on the site, not just on the calendar. It looks like the javascript file is loaded on every page of the site, but adding class="popup" only results in an empty DIV with a close button, without actually loading the content. Can anyone please help me solve this? A link to what I'm working on is he http://67.220.206.170/~jazzbone/?q=home. The upcoming events section is a block from the Calendar view (created by the Calendar module), however it does not do popups by default like the calendar page, so I've tried adding class="popup" to these links to make it work. You can see in the main body of the page is a test link with class="popup" as a test as well. I want them to behave like the popups on the event calendar page. I think this is the javascript file in question: http://67.220.206.170/~jazzbone/site...r/jcalendar.js I know this is a lot, and I'm a newbie here, but I appreciate any help, thanks. Hello, Take a look at this page and this just what I want: http://yensdesign.com/tutorials/popupjquery/ But I have two issues concerning this: 1)I am able to insert a youtube image into the popup BUT when I click on the 'X' the popup disappears but the audio remains.What I would like to do is somehow alter the code so the popup is "destroyed" and the clip is stopped completely including the audio. 2) I also want to able to adapt the code so that I can click on any one of multiple youtube links and get the same effect. My javascript capabilities aren't that strong so any help or links to other pages or suggestions are welcome. Iv been looking and trying to get something like this forever but cant find it so can some help: I need a script that when you click the link it has a popup box with a form in it but thats easy to find, what im having trouble finding is a script that when you click submit on the form it stays in the popup box and you could use the information submited in the form. Unable to close the popup. Have done the best I can Can someone please help me here. Would also like to be able to display without scrolling bars Here is the link http://www.videowebmastery.com/video...ters/index.htm Cheers Hello everyone... I need "No-Block PopUp Window" for my web site.. for example if users open my sites another sites show or opens for them.. even a full page site like full pages ads.. and it be like One time per hour or more.. I found some script like that but some of them being blocked by IE or other browsers.. if anyone has kinda this JS code.. Please share it.. Thanks a lot I struck to open a popup window after submit the page. I used the following logic . but it's not open. Code: out.println("<a href=\"javascript:ozPopup('ozPpolApptChangeStartTime.jsp?apt=RptAppt&apptId="+id+"&date="+date+"','PpolApptLov','left=100,top=60,width=640,height=300,scrollbars=yes,resizable=yes');\">"); the bove code write in the scriptlet . Trying to get this link to close window onclick, can I even do it? I'm just not seeing how, but I'm probably missing the obvious... Code: <img usemap="#map3" id="shapeimage_5" src="Notice2_files/shapeimage_5.png" style="border: none; height: 49px; left: -67px; position: absolute; top: -3px; width: 261px; z-index: 1; " alt="December 2011 notice" title="" /><map name="map3" id="map3"><area href="https://docs.google.com/open?id=0BwxS6NVXBkCvMTZiMTc1MzYtNDA1Yi00YzRjLWFjNDktNGI5ZDVjYTJkNTkw" title="https://docs.google.com/open?id=0BwxS6NVXBkCvMTZiMTc1MzYtNDA1Yi00YzRjLWFjNDktNGI5ZDVjYTJkNTkw" alt="https://docs.google.com/open?id=0BwxS6NVXBkCvMTZiMTc1MzYtNDA1Yi00YzRjLWFjNDktNGI5ZDVjYTJkNTkw" coords="67, 3, 258, 46" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" /></map> Hi - I have used two scripts that I found on the web - both proport to only load a popup once per session - one is from pc magazine April issue, another I will list here - they use cookies, here is my dir structure on my web site root dir1 dir2 dir3 .js is in root, pages in dir1 and dir2 and dir3 call it, popup comes up once per dir hit, not once per site hit! My site informationhighwaytohell.com go to travelogue, then move around, you see popup is loading more than once - what gives? The js is in a .js file that gets called by every page http://javascriptkit.com/popwin/index.shtml <script> //Popup Window Script //By JavaScript Kit (http://javascriptkit.com) //JavaScript tutorials and over 400+ free scripts function openpopup(){ var popurl="http://fullwebaddresshere" winpops=window.open(popurl,"","width=400,height=338,") } function get_cookie(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 loadornot(){ if (get_cookie('poppedup')==''){ openpopup() document.cookie="poppedup=yes" } } loadornot() </script> |