JavaScript - Javascript For Open And Close Automatically
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. Similar TutorialsHello! 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. suggestions welcome !!
Hi friends.... I have an alert message just like Code: alert("Hiii"); I want to close it automatically as soon as it appears. It means I don't want to show this alert message to client. Can anyone tell how i can do it??? Please help me...... Thanks in advance.... My code works but when I put an image in there my code doesn't work anymore. Quote: <html> <head> <style type="text/css"> .planType{display:none; width:600px} </style> <script type="text/javascript"> <!-- function planTypeOpen(planID) { document.getElementById('info_' + planID).style.display = "block"; document.getElementById('title_' + planID).innerHTML="<a href=\"javascriptlanTypeClose('" + planID + "');\">Check this out" + "</a>"; } function planTypeClose(planID) { document.getElementById('info_' + planID).style.display = "none"; document.getElementById('title_' + planID).innerHTML="<a href=\"javascriptlanTypeOpen('" + planID + "');\">Check this out" + "</a>"; } //--> </script> </head> <body> <div id="title_1"><a href="javascriptlanTypeOpen('1');">Check this out</a></div> <div id="info_1" class="planType"> You can't see me...<br> Or Can you?? </div> </body> </html> any comments would be greatly appreciated. hello everybody I have a list like this Code: <ul id="main_menu"> <li><a href="#">Comments</a></li> <li><a href="#"> Advertising </a> <ul> <li><a href="#">edit/delete ads</a></li> <li><a href="#">Add Ads</a></li> </ul> </li> <li><a href="#">Groups</a></li> <li><a href="#">Members</a> <ul> <li><a href="#">Edit / Delete Member</a></li> <li><a href="#">Add Member</a></li> </ul> </li> <li><a href="#">Photo</a> <ul> <li><a href="#">edit / Delete Photo</a></li> <li><a href="#">Add a picture</a></li> </ul> </li> <li><a href="#">Sections</a> <ul> <li><a href="#">Edit / Delete section</a></li> <li><a href="#">Add Section</a></li> </ul> </li> <li><a href="#">General Settings</a></li> <li><a href="#">Home</a></li> </ul> This list contains lists of 8, including 4 lists contain children (Advertising , Members,Photo,Sections) And I've written this code but did not work very well Code: function MainMenu(item){ var MenuItems = document.getElementById('main_menu'); for (var i = 0; i < MenuItems.children.length; i++) { MenuItems.children[i].children[1].style.display = "none"; } item.children[1].style.display = "block"; } What i needed is when i press a list containing the submenus Close all open lists Then open this menu Hi! I need to open a window when: 1 user leaves the site 2 when the browser is closed. I tried the 'unLoad' event but it works only for the user leaves site case and not the browser close. Here is the code I tried: <html> <head> <title>Detecting browser close </title> <script type="text/javascript"> function doUnload() { myWin= open("exit_site.php", "exitWin", "width=50,height=50"); } </script> </head> <body onunload="doUnload()" <h4>Close browser!</h4> </body> </html> Neep your help, please Hello, First post here. I have the need to create a popup after a delay. The problem I'm getting is that the parent page is refreshing automatically from the action of creating the popup. I don't want the parent page to refresh! This is what I currently have: Code: $popupScript = ' <script language="JavaScript"> setTimeout("window.open(\'index.php?do=renew\',\'Popup1\',\'toolbar=0, width=500, height=500\')",' . $delay . '); </script>'; The page is in php, so that's why I have it as a string, which I later pass to a template page. This would simply be: Code: <script language="JavaScript"> setTimeout("window.open('index.php?do=renew','Popup1','toolbar=0, width=500, height=500')",6000); </script> ... if it was placed straight into the HTML. Incidentally, it's included into the HTML HEAD area, not the body, as the original source of the script suggested: http://www.itechies.net/tutorials/js...op-delayed.htm $delay is the delay before the popup opens, in microseconds (so 6000 would be 6 seconds). What can I do to have the same delayed auto-popup functionality, but without it automatically refreshing the parent page where the above code resides? As some background to what I'm achieving: The issue with not wanting the parent page to refresh is that each time it does, the login session gets extended. The popup itself (which I already have working ok) provides a 'continue working' function, or close and refresh the parent is nothing has been done after a short period. Any help very welcome. Hello. I'm trying to open extra information if a user clicks on a TD, and close it if he click on it again. How I can do this? All I learned to do is to show it, but I can't find something that hide it if I click on the same place. Thanks for help. __________________ הורדות Hi. I need help in adding a parenthesis in the area code of the phone number and validating it also. I made some javascript code but it is not working. Can somebody please help? I just need the code in adding () in the area code. For example: When user enter 10 digit number no spaces or dashes such as 0000000000 or 000-000-0000, I would like to have this format right away (000)000-0000. I know how to replace the characters but adding it is a tricky one for me. Can somebody please help? Thanks. Hi, I want to restrict opening my popup window if it is already opened. For simple scenario, it is quite possible to do but in my case -- 1) When parent page is opening popup window, it is getting refreshed (required from client for some reason). 2) Once submit button is clicked from popup window, again parent page is getting refreshed (again its a requirement from client side). With these 2 conditions, I lost my saved value from variable and hence new popup is keep coming when the action is same. Currently I am using below code to open popup [CODE] function OpenWindow() { if(winPop && !winPop.closed) { alert("Popup is already open"); } else { winPop = window.open('MyPopupPage.aspx'); } } [CODE] Please help me to get rid of this problem. Thanks in advance. - Bhasker I am using a window.open to trigger a mailto: command. I don't want the window to stay open so I try to close it right after. The default email client launches correctly, but the window stays open and I get the following Javascript error: Unable to get value of the property 'close': object is null or undefined Code: Code: var win = window.open(mailto_link,'emailWindow'); win.close(); 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> I am developing a web application based on a Java servlet. The servlet outputs html and javascript codes and receives some result from a thread, which works behind the servlet. Thus, html and javascript codes dynamically varies. While result equals null (a thread is not completed), it shows "Currently processing," and refreshes Code: <div id="load"> - </div> every second automatically. After receiving some results, it should stop automatic refreshing and show "Done." I wrote source codes described below. It shows "Done" after getting some results, but does not stop refreshing. However, when I manually refresh the page (Ctrl-R), the script is loaded and reloading is stopped. How can I pull javascript codes automatically? Code: <head> <script type=\"text/javascript\"> var auto_refresh = setInterval( function start() { $('#load').load('./Page' + ' #load'); }, 1000); </script> </head> <div id="load"> if (result == null) { // the variable result is received from a behind thread every second. // while a thread is processed <p>Currently processing. <p> } else { // a thread is completed // try to stop reloading <script type=\"text/javascript\"> clearInterval(auto_refresh); </script> <p>Done. <p> } </div> 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> 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 Hi... Is there anyway to differentiate between refreshing a window and closing the browser. It seems both events are handled by onUnload event. Thanks Hi guys, it's a bit of a large question but I've been messing around with code for a while, and nothing seems to work... Basically, I need to make, a 'dynamic theme changer'. Basically what I need to do is have several drop down boxes, each one with some colours available as options. When you select one, it automatically (without refreshing the page) updates a certain element's style. For example, if you selected green as one colour and red as another, the element linked to the first drop-down would turn green, and the element linked to the second drop-down would turn red, and so on so forth. It then needs to have a 'save' button, which saves the settings, and adds a cookie with the style details so that when they visit the page again it's still personalized. There also needs to be a cancel button which discards all changes. I know it's a large question but I'm ripping my hair out over this one! =P Your help is much appreciated. 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> |