JavaScript - How To Keep Popup In Front At All Time?
I would like to have a popup in front at all times, for instruction purpose, even when user doing something in back page, such as type something, select and change to new page, etc.
This popup can only be closed by either click at "Close" button or "X" at top right corner. Similar TutorialsI popup a txt msg queue window - it sits in the background - it reloads the msg queue every minute - when a new one pops into the queue I want to bring window to the front but the following code doesn't do that. Am I doing this right? PHP Code: function init() { document.forms[0].btn_close_window.focus(); } I am looking to scan a page, find all the url's on the page. Once I have them, I want to append the front of the url (hardcoded and never changes) with hardcoded code. Like a Find and Replace. for example: locate the front of all the urls which is - wincfprod032 and replace with wincfprod032.jewels 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> I have to create a mock up page with a popup that reopens every time you close it. Can someone explain to me how to do this?
I have merged two scripts to make a popup that comes up even if blocked, and is for first time visitor only (cookie). The problem is that the way I'm doing it, it might show one or more times to the visitor. I don't want that because it will be irritating and this is a high-priority client. I'm posting the whole script because I think the problem is calling the popup before checking the cookie, but not sure how to rearrange things. Also, I did search and found some good dhtml stuff but don't want to rewrite. This was supposed to be done last night so if I can fine tune this for now, I'll have time to rewrite something better (or at least play around with another script). Also, the popup refuses to come up in IE - I have IE6, but I detest IE and their site doesn't even load in it so whatever. I tested in FFox3, Opera 10 and Safari and it seems to work but like I say because of the onclick - it will load at any click until the user goes to a different page. I added a refresh in there but it just made things worse - too much going on for the user at that point. Thanks for any suggestions. I hope I've used the right tags for this. I've highlighted the stuff at the bottom that I think is where I need the most help. Here is the code: // added for popup -kk var expDays = 100; // number of days the cookie should last //var page = "only-popup-once.html"; //var windowprops = "width=300,height=200,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes"; var newwin = null; function openwin() { // window.location.reload(); var url = "/NEWSLETTER.html" try { if (newwin != null && typeof(newwin.location.href) != 'undefined') { newwin.location.href = url; } else { newwin = open(url, "Subscribe", "height=390,width=545,screenX=0,left=0,screenY=0,top=0,channelmode=0,dependent=0,directories=0,fulls creen=0,location=0,menubar=0,resizable=yes,scrollbars=0,status=0,toolbar=0"); } newwin.focus(); } catch (e) { newwin = open(url, "Subscribe", "height=390,width=520,screenX=0,left=0,screenY=0,top=0,channelmode=0,dependent=0,directories=0,fulls creen=0,location=0,menubar=0,resizable=yes,scrollbars=0,status=0,toolbar=0"); newwin.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" : ""); } function DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } var exp = new Date(); exp.setTime(exp.getTime() + (expDays*24*60*60*1000)); function amt(){ var count = GetCookie('count') if(count == null) { SetCookie('count','1') return 1 } else { var newcount = parseInt(count) + 1; DeleteCookie('count') SetCookie('count',newcount,exp) return count } } function getCookieVal(offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function checkCount() { var count = GetCookie('count'); if (count == null) { count=1; SetCookie('count', count, exp); // window.open(page, "", windowprops); window.onclick = openwin; // window.location.reload(); } else { count++; SetCookie('count', count, exp); } } window.onload=checkCount; // end popup -kk i've been trying to toy with this script, which works fine.. except for a few things http://jsfiddle.net/f9j9a/112/ what i would like it to do is to, for instance, always keep div1 on top.. no matter what other div is clicked and when you've brought one of the divs to the front and click on a different one, i want it to move directly behind the newly clicked div.. so is has to mimic the way it works on your OS any ideas?? Hi guys, I want to have a flash object, that when clicked comes to the front of the html content below it. For example i want the Flash to be say 100px tall by 500px wide. When clicked i want the flash to scale to 500 x 500, and come to the front of the html content below it. I have the development of the flash object covered. I just dont know how to bring the flash to the front of the html content and scale the dimentions in the embed code. I attached screen shots of what i want to accomplish. Can anyone point me in the direction of a tutorial, or help in any way. Thanks in advance! I am using the below code to create a blogging site but the pagination in one tab apprears in the other tab. How do I individually create a pagination for each tab? <?php // Begin session, initiate database connection, etc. require_once('./includes/base.php'); // If logging out, delete session variables if($_GET['logout'] == 1){ @$_SESSION = array(); @session_unregister($_SESSION['userID']); @session_unregister($_SESSION['userName']); @session_unregister($_SESSION['userUser']); @session_unregister($_SESSION['userPass']); @session_destroy(); } // Display header require("./templates/$template/header.php"); ?> <div id="blurb" align="right"> <script language="javascript"> function isClear() { document.myForm[0].value=''; return true; } </script> <!-- new search --> <?php ob_start(); if(!empty($_SESSION['userID']) and !empty($_POST['user'])){ echo '<form action="search.php" method="post" name="myForm"> <input type="text" value="search here" id="search" size="20" name="search" onFocus="return isClear();"/> <input type="submit" name="serachuser" value="search"/></form>'; } ?> </div> <br> <div id="blurb" align="justify"> <em>Hello world</em> <?php echo "$sitename"; ?> is blah blah blah.... </div> <br> <div id="container-5"> <ul> <li><a href="#fragment-13"><span>Blogs</span></a></li> <li><a href="#fragment-14"><span>Links</span></a></li> <li><a href="#fragment-15"><span>Images</span></a></li> </ul> <div id="fragment-13"> <?php $sql = mysql_query("SELECT users.userUser, posts.postID, posts.postPost, posts.postTime, posts.postComments, userAvatar FROM users, posts WHERE users.userID = posts.postUserID ORDER BY posts.postTime DESC "); while($row = mysql_fetch_array($sql)){ $abcd= $row['userName']; $abcd = str_replace (" ", "-", $abcd); $time = reltime($row['postTime']); echo ' <div class="virtualpage"> <table width="100%" > <td width="10%" ><a href="'.$site_url.'/'.$row['userUser'].'"><img src="'.$site_url.'/avatars/'.$row['userAvatar'].'" width="48px" height="48px" /><td width="90% "bgcolor="#F8F8F8" border=1" cellspacing="1" cellpadding="1" ><b>'.$row['postPost'].'</b><br>Posted by: '.$row['userUser'].', <a href="'.$site_url.'/blogs/'.$row['userUser'].'/'.$row['postID'].'">Comments</a> '.$row['postComments'].' , Time elapsed: '.$time.'</a></td> </table><br> </div>';} ?> <? echo '<div id="gallerypaginate" class="paginationstyle"> <a href="#" rel="previous">Prev</a> <span class="flatview"></span> <a href="#" rel="next">Next</a> </div>' ; ?> </div> <div id="fragment-14"> <?php $sql = mysql_query("SELECT users.userUser, links.linksID, links.linksLink, links.linksPost, links.linksTime, links.linksComments,userAvatar FROM users, links WHERE users.userID = links.linksUserID ORDER BY links.linksTime DESC"); while($row = mysql_fetch_array($sql)){ $abcd= $row['userName']; $abcd = str_replace (" ", "-", $abcd); $time1 = reltime($row['linksTime']); echo ' <div class="virtualpage"> <table width="100%" > <td width="10%" ><a href="'.$site_url.'/'.$row['userUser'].'"><img src="'.$site_url.'/avatars/'.$row['userAvatar'].'" width="48px" height="48px" /><td width="90% "bgcolor="#F8F8F8" border=1" cellspacing="1" cellpadding="1" ><b>'.$row['linksPost'].'</b><br>Posted by: '.$row['userUser'].', <a href="'.$site_url.'/blogs/'.$row['userUser'].'/'.$row['linksID'].'">Comments</a> '.$row['linksComments'].' , Time elapsed: '.$time1.'</a></td> </table><br> </div>';} ?> <? echo '<div id="gallerypaginate" class="paginationstyle"> <a href="#" rel="previous">Prev</a> <span class="flatview"></span> <a href="#" rel="next">Next</a> </div>' ; ?> </div> <div id="fragment-15"> <?php // test grabimages('SELECT users.userUser, images.imagesID, images.imagesFile, images.imagesPost, images.imagesTime, images.imagesComments FROM users, images WHERE users.userID = images.imagesUserID ORDER BY images.imagesTime DESC LIMIT 20'); ?> </div> </div> <?php // Display footer require("./templates/$template/footer.php"); ?> <table align="center"><tr><td align="center"> <script type="text/javascript" defer="defer"> var gallery=new virtualpaginate("virtualpage",10) gallery.buildpagination("gallerypaginate") </script> </td></tr></table> Thank you ....... Hi, 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. :-) Hi, I am somewhat new to HTML, AJAX, and CSS. I'm wish to implement something similar to what Tumblr does on their front page where you click on the bottom footer bar, and the page horizontally shifts up keeping part of the original page (specifically, the email sign up) visible while exposing more content. I know the simplest is to have the entire content on the page and just "hide" and "show" the interested components "on click" of the bottom footer bar div-tag. But I like the sliding animation. Does YUI or JQuery provide the ability to do the animation? Or is this even a Javascript related functionality - ie should I look at HTML5 or CSS? Thanks Jack Hi Code: var err_str=""; function validate_grid(value,id,ind) { $("#result").html(" ").show(); if(ind==1 || ind==2) { var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/; if(!patt.test(value)) { mygrid.setCellTextStyle(id,ind,"background-color:yellow;"); if(err_str!="") err_str+="\n"+(ind+1)+".Enter numbers and : only.."; else err_str=(ind+1)+".Enter numbers and : only"; return false; } else { mygrid.setCellTextStyle(id,ind,"background-color:white;"); return true; } } } alert(err-str); here ind==1 is from_time and ind==2 is to_time,i need to validate time as to_time must be always greater than from-time,if condition fails an alert msg should populate.time format is[05:00]as it is in string format im unable to do the validation for it.(ex:from-time=08:00 to-time=07:59 condition fails) thank you. hi im using dhtml xgrid where i need to do validation for time ,(from-time and to-time i.e ind==1 and ind==2 ) to-time must be greater than from-time else i need to alert a message to-time must be greater than from-time. can any one send me the code for it time format is[05:00]. Code: var err_str=""; function validate_grid(value,id,ind) { $("#result").html(" ").show(); if(ind==1 || ind==2) { var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/; if(!patt.test(value)) { mygrid.setCellTextStyle(id,ind,"background-color:yellow;"); if(err_str!="") err_str+="\n"+(ind+1)+".Enter numbers and : only.."; else err_str=(ind+1)+".Enter numbers and : only"; return false; } else { mygrid.setCellTextStyle(id,ind,"background-color:white;"); return true; } } } Hello im using dhtmlx grid in this cells i have from time and to time (i.e ind==1 and ind==2) i need to validate time where to-time must be greater than from-time else it should alert an message,i have writeen a normal Regular expression for the time validation.as the time is i string format i.e[05:00],please can any one send me code for that. Code: var err_str=""; function validate_grid(value,id,ind) { if(ind==1 || ind==2) { var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/; if(!patt.test(value)) { mygrid.setCellTextStyle(id,ind,"background-color:yellow;"); if(err_str!="") err_str+="\n"+(ind+1)+".Enter numbers and : only.."; else err_str=(ind+1)+".Enter numbers and : only"; return false; } else { mygrid.setCellTextStyle(id,ind,"background-color:white;"); return true; } } } 1 down vote favorite I do have the countdown script (see link below) to display the time between current time and the date given in real-time. However, I want to achieve to display the time difference between a given start and end time. Right now, it calculates from the current server time to the end time. I want to be able to set up my own start time and end time. Here is what I have: http://jsfiddle.net/BgEtE/ thank you for help I'm not really a Java writer, so I don't know how to do this myself, though I imagine it would be pretty simple. I am looking to add a script to a webpage that allows users to input a time manually, and have it converted to GMT/Zulu time and display the converted time. I have seen a lot of time zone conversion scripts online, but they all just convert whatever the current system time is to another time zone. I am looking for a script that allows users to convert a time and show the zulu time, for times other than the current time. The time zone the inputed local time would be in is +4:30 (Kabul). I don't really care about style or aestehtics, just a simple script I can insert into a web page to have a time input field. The converted output time can appear in another field, a popup bubble, etc, again style isn't really an issue. It's really just to help people in my job who need to know what the GMT/Zulu time was for certain local times after the fact. One would think it shouldn't be that hard to just subtract 4:30 in your head, but apparently it is. Sorry if just asking for code outright like this is frowned upon. hi, can some one help me how to get the time and date difference? given two time and date with the following format like in textbox A: 2011-05-03 17:35:47.0 and textbox B: 2011-05-03 16:35:47.0 then the output would be: 0 days, 1 hour, 0 minutes, 0 seconds regards, verve This is my first time doing JavaScript I don't what I did wrong here, but the problem its not showing up the current date and time. Code: <script language = "JavaScript" type="text/javascript"> now = new Date(); localtime = now.toString(); utctime = now.GMTString(); document.wite("<b>localtime</b>" + localtime + "</br>"); document.write("<b>utctime</b>" + utctime); </script> This is what supposed to look like I have tried using different browser chrome,IE9,Maxtor, and Opera my OS is Win7 Hi - I have a date in my javascript like this: Mon Dec 12 00:00:00 UTC+0430 2011 I need to convert it to a date without the offset (the +0430). I actually changed my computer's timezone to generate this offset - we have uses placing orders on our site who don't use UTC and it's throwing our orders out as they need to select a delivery date but it's passing the date with the offset. How do I convert a date to UTC time? Thanks Hi there! Well, I recently found the Image clock code, and I am loving it! But, I would like it to only display pacific time, not retrieve the time from a users browser. Here's my code: Code: <script type="text/javascript"> /*********************************************** * JavaScript Image Clock- by JavaScript Kit (www.javascriptkit.com) * This notice must stay intact for usage * Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more ***********************************************/ var imageclock=new Object() //Enter path to clock digit images here, in order of 0-9, then "am/pm", then colon image: imageclock.digits=["/users/1712/49/18/66/album/c012.png", "/users/1712/49/18/66/album/c112.png", "/users/1712/49/18/66/album/c211.png", "/users/1712/49/18/66/album/c311.png", "/users/1712/49/18/66/album/c411.png", "/users/1712/49/18/66/album/c511.png", "/users/1712/49/18/66/album/c611.png", "/users/1712/49/18/66/album/c711.png", "/users/1712/49/18/66/album/c811.png", "/users/1712/49/18/66/album/c911.png", "/users/1712/49/18/66/album/cam11.png", "/users/1712/49/18/66/album/cpm13.png", "/users/1712/49/18/66/album/ccolon11.png"] imageclock.instances=0 var preloadimages=[] for (var i=0; i<imageclock.digits.length; i++){ //preload images preloadimages[i]=new Image() preloadimages[i].src=imageclock.digits[i] } imageclock.imageHTML=function(timestring){ //return timestring (ie: 1:56:38) into string of images instead var sections=timestring.split(":") if (sections[0]=="0") //If hour field is 0 (aka 12 AM) sections[0]="12" else if (sections[0]>=13) sections[0]=sections[0]-12+"" for (var i=0; i<sections.length; i++){ if (sections[i].length==1) sections[i]='<img src="'+imageclock.digits[0]+'" />'+'<img src="'+imageclock.digits[parseInt(sections[i])]+'" />' else sections[i]='<img src="'+imageclock.digits[parseInt(sections[i].charAt(0))]+'" />'+'<img src="'+imageclock.digits[parseInt(sections[i].charAt(1))]+'" />' } return sections[0]+'<img src="'+imageclock.digits[12]+'" />'+sections[1]+'<img src="'+imageclock.digits[12]+'" />'+sections[2] } imageclock.display=function(){ var clockinstance=this this.spanid="clockspan"+(imageclock.instances++) document.write('<span id="'+this.spanid+'"></span>') this.update() setInterval(function(){clockinstance.update()}, 1000) } imageclock.display.prototype.update=function(){ var dateobj=new Date() var currenttime=dateobj.getHours()+":"+dateobj.getMinutes()+":"+dateobj.getSeconds() //create time string var currenttimeHTML=imageclock.imageHTML(currenttime)+'<img src="'+((dateobj.getHours()>=12)? imageclock.digits[11] : imageclock.digits[10])+'" />' document.getElementById(this.spanid).innerHTML=currenttimeHTML } </script> <DIV STYLE="position:absolute; top:260px; left:215px; width:109px; height:28px"> <FONT SIZE="+2" COLOR="black"> <TABLE BORDER="0" cellpadding="10" CELLSPACING="0" TOP MARGIN="0"> <TR> <TD WIDTH="109" HEIGHT="28" BACKGROUND="/users/1712/49/18/66/album/clock210.png" VALIGN="top"> <script type="text/javascript"> new imageclock.display() </script> </TD> </TR> </TABLE> </DIV> Much 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. |