JavaScript - Javascript Close Link?
Can someone tell me how to make a close button for this? The close button I currently have here makes the IMAGE2 disappear but I cannot see IMAGE1 until the time runs out on the setTmeout. I want to be able to click the closeX and close out the whole script leaving IMAGE1 showing. Here is what I have:
Code: <table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" bgcolor="#000000" height="350"> <tr> <td align="center"> <script type="text/javascript"> window.onload = function () { setTimeout(function () { var div = document.getElementById('hideOverlay'); div.innerHTML = 'IMAGE1 GOES HERE'; }, 6000);} </script> <div id="hideOverlay"> <table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" height="350"> <tr> <td align="center" width="650" height="350"><a style="text-decoration: none" href="javascript:void(0)" onclick="var lyr =document.getElementById('hideOverlay'); lyr.innerHTML='';"/><font color="#666666" size="2">Close [x]</font></a>IMAGE2 GOES HERE</td> </tr> </table></div> </td> </tr> </table> </div> Similar TutorialsHello i have a sticky tooltip that when is in "sticky mode" the only way to close it is by clicking outside of it. I wanted to add a mouseover link for a close link so it can also be closed that way. original code: http://www.dynamicdrive.com/dynamici...ckytooltip.htm this is my external .js code and if you look about 11 lines down i have the mouseover link setup for the word "CloseMe". However that's where i need to know how to call it properly? Quote: /* Sticky Tooltip script (v1.0) * Created: Nov 25th, 2009. This notice must stay intact for usage * Author: Dynamic Drive at http://www.dynamicdrive.com/ * Visit http://www.dynamicdrive.com/ for full source code */ var stickytooltip={ tooltipoffsets: [5, -5], //additional x and y offset from mouse cursor for tooltips fadeinspeed: 1, //duration of fade effect in milliseconds rightclickstick: true, //sticky tooltip when user right clicks over the triggering element (apart from pressing "s" key) ? stickybordercolors: ["black", "darkred"], //border color of tooltip depending on sticky state stickynotice1: ["To Sticky:", "Press Key \"c\"", "or Right click"], //customize tooltip status message stickynotice2: "Sticky Activated! <a onMouseOver=javascript:LOSTT.HELPP('mystickytooltip'); href=google.com>CloseMe</a>", //customize tooltip status message //***** NO NEED TO EDIT BEYOND HERE isdocked: false, positiontooltip:function($, $tooltip, e){ var x=e.pageX+this.tooltipoffsets[0], y=e.pageY+this.tooltipoffsets[1] var tipw=$tooltip.outerWidth(), tiph=$tooltip.outerHeight(), x=(x+tipw>$(document).scrollLeft()+$(window).width())? x-tipw-(stickytooltip.tooltipoffsets[0]*2) : x y=(y+tiph>$(document).scrollTop()+$(window).height())? $(document).scrollTop()+$(window).height()-tiph-10 : y $tooltip.css({left:x, top:y}) }, showbox:function($, $tooltip, e){ $tooltip.fadeIn(this.fadeinspeed) this.positiontooltip($, $tooltip, e) }, hidebox:function($, $tooltip){ if (!this.isdocked){ $tooltip.stop(false, true).hide() $tooltip.css({borderColor:'black'}).find('.stickystatus:eq(0)').css({background:this.stickybordercol ors[0]}).html(this.stickynotice1) } }, docktooltip:function($, $tooltip, e){ this.isdocked=true $tooltip.css({borderColor:'darkred'}).find('.stickystatus:eq(0)').css({background:this.stickyborderc olors[1]}).html(this.stickynotice2) }, init:function(targetselector, tipid){ jQuery(document).ready(function($){ var $targets=$(targetselector) var $tooltip=$('#'+tipid).appendTo(document.body) if ($targets.length==0) return var $alltips=$tooltip.find('div.atip') if (!stickytooltip.rightclickstick) stickytooltip.stickynotice1[1]='' stickytooltip.stickynotice1=stickytooltip.stickynotice1.join(' ') stickytooltip.hidebox($, $tooltip) $targets.bind('mouseenter', function(e){ $alltips.hide().filter('#'+$(this).attr('data-tooltip')).show() stickytooltip.showbox($, $tooltip, e) }) $targets.bind('mouseleave', function(e){ stickytooltip.hidebox($, $tooltip) }) $targets.bind('mousemove', function(e){ if (!stickytooltip.isdocked){ stickytooltip.positiontooltip($, $tooltip, e) } }) $tooltip.bind("mouseenter", function(){ stickytooltip.hidebox($, $tooltip) }) $tooltip.bind("click", function(e){ e.stopPropagation() }) $(this).bind("click", function(e){ if (e.button==0){ stickytooltip.isdocked=false stickytooltip.hidebox($, $tooltip) } }) $(this).bind("contextmenu", function(e){ if (stickytooltip.rightclickstick && $(e.target).parents().andSelf().filter(targetselector).length==1){ //if oncontextmenu over a target element stickytooltip.docktooltip($, $tooltip, e) return false } }) $(this).bind('keypress', function(e){ var keyunicode=e.charCode || e.keyCode if (keyunicode==99){ //if "c" key was pressed stickytooltip.docktooltip($, $tooltip, e) } }) }) //end dom ready } } //stickytooltip.init("targetElementSelector", "tooltipcontainer") stickytooltip.init("*[data-tooltip]", "mystickytooltip") below is my html code Quote: <a href="http://www.link2.com"><img src="http://www.dynamicdrive.com/ddincludes/logo.gif" data-tooltip="id1" /></img></a> <div id="mystickytooltip" class="stickytooltip"> <div style="padding:5px"> <div class="stickystatus"></div> <div id="id1" class="atip" style="width:200px"> <iframe src="http://www.link.com"></iframe></div> </div></div> Hello! I am trying to find a script that allows you to open multiple browser tabs and then close each of those tabs, either one by one or all at once. Does anyone know how to do this please? Thanks so much for your help. I made a private message page that shows as a popup but the problem is it wont close itself after a 3 second (3000 millisecond) pause Code: <script type="text/javascript"> setTimeout("self.close();",3000); </script> This was the original code I found: Code: setTimeout('self.close();',30000); **FIXED** I was trying to close a tab instead of the window. The popup was a window that had a set url that could not be changed so i used a tab to access the page I wanted. Tested and works now Hello guys, im working on another little project for my team here, and the way our system works is in order to change a persons password, there is a certain link that has to be accessed...for example...if i want to change a persons password, lets say UserID: t-test100 current pass: 911 and i want to change the password to 999 instead of 911...there is a link that needs to sorta load the profile in the background first in order to do the password change, i got the password change page down to a T and it works like a charm, but ONLY when the link is accessed, so for example, this is how the link would look like https://www.***.com/Sps/jsp/MyChange...?uid=t-test100 as soon as that URL is accessed, my code that i made for the password reset, works, but if i open a fresh window (where no cookies have been logged) and i go directly to my page where i have the script to change the password, it will come back with an error, but when i go to that URL and then back to my script and run it again, it works fine....SOOOO...back to my question...how would i be able to make it so that i have an extra link on my site that i can add to go to https://www.***.com/Sps/jsp/MyChange...?uid=t-test100 URL in a new window...but i want it so that when i click the link, it opens up the URL and closes the window after 1 second...or less...just so that it loads the URL in the background and thats it basically what i need to do, just for it to open for a split second, for the browser to register that i've visited the URL for that particular username, and then so that when i try to change the password, it goes through. The web page belows works OK in IE and FireFox on XP and Windows7 It does NOT work on IPAD using Safari. Question: How can I delete the new window("IPADREPORT") when I run it the second, third,fourth, etc time ? How can I get the window name( "IPADREPORT") to see if it exists? SUggestions? TIA, Steve42 <code> [aSafari.html] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <script language="JavaScript" type="text/javascript"> function pReport(){ // 1-17-12 var menuWindow = open("","ipadreport"); // 1-17-12 menuWindow.close(); // above closes previous report window var menuWindow = window.open('','ipadreport');// 1-17-12 document.ipadreport.submit(); menuWindow.focus(); } </script> <title>Ipad_PopUp_Test</title> </head> <body> <br><br> <form method=post name="ireport" target="ipadreport" action="http://myreport.asp"> <input type="hidden" name="reporttest" value="apple"> <a href='javascriptReport()'> Create Report</a> </form> </body> </html> </code> Hi... Is there anyway to differentiate between refreshing a window and closing the browser. It seems both events are handled by onUnload event. Thanks How to center javascript popup without css? Cant get close button working(wrong position and dosen't close popup). Code: <script language="javascript"> function openPopup(a, b, c){//a = url, b = width, c = height var pOverlay, pContent, pClose; pOverlay = document.createElement('div'); pOverlay.className = 'popupOverlay'; pContent = document.createElement('div'); pContent.className = 'popupContent'; pClose = document.createElement('div'); pClose.className = 'popupClose'; document.body.appendChild(pOverlay); document.body.appendChild(pContent); var myRequest = new ajaxRequest(); myRequest.open('GET', a, true); myRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); myRequest.send(null); myRequest.onreadystatechange = function(){ if(myRequest.readyState == 4 && myRequest.status == 200){ pContent.innerHTML = myRequest.responseText; } } } </script> Code: <style type="text/css"> .popupOverlay { background: #000000; opacity: 0.8; position: fixed; top: 0%; left: 0%; width: 100%; height: 100%; z-index: 1001; } .popupContent { background: #333333; border: 2px solid #DDDDDD; box-shadow: 0px 0px 20px #999999; border-radius: 3px; position: absolute; top: 50%; left: 50%; padding: 5px; z-index: 1002; overflow: auto; word-wrap: break-word; color: #FFFFFF; /*height: 300px; width: 500px;*/ } .popupClose { background: url('images/closePopup.png') no-repeat; width: 32px; height: 32px; cursor: pointer; } </style> Hi, Which javascript event should be used to call logout on window close and url change. I want to call logout function on window close and URL change on my application. I am calling logout functionon on <body onunload="doLogout();">, but onunload event is also called when refreshing the page. is there any specific event for Windoe close and URL change. can anyone resolve this issue. Regrads, Abha suggestions welcome !!
Does anyone know how to make URL links that use Javascript still work when users have Javascript disabled on their browser? The only reason I'm using JS on a URL is because my link opens a PDF file, and I'm forcing it not to cache so users have the latest version. I tried the <script><noscript> tags, but I'm not sure if I'm using it correctly, as my URL completely disappears. Below is my HTML/Javascript code: <p class="download"> <script type="text/javascript">document.write("<span style=\"text-decoration: underline;\"><a href=\"javascript:void(0);\" onclick=\"window.open( 'http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf?nocache='+ Math.floor( Math.random()*11 ) );\" >The Child Magazines Media Kit</a></span> (PDF 1 MB) ");</script> <noscript><span style="text-decoration: underline;"><a href="http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf" >The Child Magazines Media Kit</a></span> (PDF 1 MB)</noscript> </p> Thanks for any help, Michael Hi! I'm new to this, so please bare with me. My terminology may not be up to par. Here's the deal: - I have a button on my Flash site that opens an HTML page in a popup window. In Flash, I open the new window using Actiosnscript 2.0: Code: on (release) { getURL("example1.html", "_blank"); } - Within the popup window are links to other HTML pages. They all open in the same window. I've been using the following to create the links in Dreamweaver: Code: onClick="MM_goToURL('parent','example2.html')" - On each page, I have a "Return to Main Menu" button that should close the popup window. To do this, I have been using: Code: onClick="window.close()" - The problem is that it works differently in each browser, and I can't even get it to consistently close the window in most browsers: Internet Explorer = popup message appears, asking "Are you sure you want to close this window?" or something similar; window closes after clicking "Yes." Safari = Only closes if I'm on the original HTML page. If I click on any of the other links (note that these all open in the same window), those pages' "Return to Main Menu" buttons cease to work. However, if I keep clicking "Back" until I get to the original page, it closes. Opera = Button actually works for each page. Firefox & Chrome = Does not close the window at all. I looked into it and saw that others have used a window.opener to solve similar issues. But, since my popup window is opened using Flash/AS2, I need to find a way around it. I've tried preceding "window.close()" with "window.opener=null" (i.e. - onClick="window.opener=null; window.close()"), but I don't think I'm doing it right because it still doesn't work. I've also seen others use codes that involve functions and variables, but it is beyond my current coding knowledge to implement this. Like I said, I'm sort of new at this. Any advice would be greatly appreciated. Thank you. - PW I have a simple problem. I want to add the current page's url to a link, like this: <code> <a href="http://www.somesite.com/somepage.aspx?a="> </code> After the 'a=' I need to add javascript that will return the current url. It can be the full url (example: http://www.codingforums.com/newthrea...=newthread&f=2) or a partial one (example: /newthread.php?do=newthread&f=2). Can someone help me with an example? in a javascript file that contains the following code, is there a way to hyperlink the word ELEPHANT ? $j('#message').html("white ELEPHANT"); is it possible to link to a page and then run a javascript all in the same href? for example, i want to redirect back to the home page after a user makes a comment and show the hidden comment div this is my javascript command: Code: <a href="javascript:InsertContent('competitiveevents'); RemoveContent('stories'); InsertContent('blog-comments');"> but can i do something like this..? Code: <a href="../index.php:javascript:InsertContent('competitiveevents'); RemoveContent('stories'); InsertContent('blog-comments');"> Hi, is it possible to make a external javascript link by giving all the external links a class name then use getelementbytagname in the js file with a function to alert the hes leaving the website and let him choose if he wants to stay or leave. well thats what im trying to do but i dont know how to write the function for it maybe i could get a suggestion or a link to agood tutorial. / thanks lisa Sup gents. Im trying to wrap some html code inside javascript. Problem is i want the picture here to link me to another page, im inserting the link command inside the picture tag put still the link isnt happening. Ive written in a wrong way? Code: document.writeln('<div id="Apartments"><table width="512" height="723" bgcolor="#666633">\n\n <tr>\n <th width="269" height="246" scope="col"><table width="243" height="208" border="1">\n <tr>\n <th height="23" colspan="2" scope="col">Apartment Fola<\/th>\n <\/tr>\n <tr>\n\n <td height="23" colspan="2"><img src="Images\/tn_G1-pokoj.jpg" alt="Fola" width="235" height="139" <a href="apartmentfola.html">/a> <\/> I've just started to learn Javascript at college, and I made a little code that traps people in a dialogue box loop. var escape = 0 for(escape === 0; escape <= 1 confirm("Going somewhere?") I want to know if there is a site, or a possibility I can start this code, simple by sending friends a URL they can click on. For completely innocent purposes, of course. Thanks! Hi, I'm pretty ignorant about Java and was wondering what the technique is to have different tabs for links on a page? (i.e. you can look through different categories while staying on the homepage). An example of what I mean is at the bottom of this page: http://www.huffingtonpost.com/ Any help would be much appreciated! Hi, i want to bring image download link to download a single image using like <a href="./images/sam.png">Download</a> when i click the download link it need to download plz help how can i download can finished Thanking you Can anyone help? i'm trying to find some references and resources on how to hide a link at a certain time and show the link again at a certain time. eg: from 12pm to 2pm the link will be display, users are able to click the link. after 2pm the link will not be displayed[hide] or the when click on the link error message will be shown. plz help. thanks! |