javascript-events

window.onbeforeunload handling ok and cancel options

北城余情 提交于 2019-12-13 04:43:28
问题 I have a window.onbeforeunload function which generates the default message "Are you sure you want to navigate away from this page...." . If we click on "OK" we are redirected to a new link and if we press "cancel" we are redirected back to the same page. I want to save some data from the page when we press "ok" and move away from the page. How can we know if "ok" or "cancel" has been pressed , then make an event call and continue with the "ok"/"cancel" option. 回答1: function leavePage() { /

Outer div is hiding when clicking on inner div

自作多情 提交于 2019-12-13 04:42:14
问题 i have client website http://indiahomeplus.com/mapview.php when clicking on filter and then selecting a query, the filter div is hiding. Its work fine in Chrome but not working in firefox and IE. ul.ldd_menu{ margin:0px; padding:0; display:block; height:50px; background-color:#Ae2f2f; list-style:none; font-family:"Trebuchet MS", sans-serif; border-top:1px solid #fff; border-bottom:1px solid #fff; border-left:1px solid #fff; -moz-box-shadow:0px 3px 4px #591E12; -webkit-box-shadow:0px 3px 4px

jquery tools tooltip doesn't appear in first try after hide()

馋奶兔 提交于 2019-12-13 04:33:49
问题 I've used tooltip for a <div> It will hide() after couple of seconds If I'll mouse over it's trigger after it for the first time it will not appear only after I move the mouse over it the second time it will appear I used onShow event for binding and used window.setTimeOut is it a problem in the tooltip or in jquery? something like this: $(document).ready(function() { x = $("button").tooltip({ api: true, position: "center right", onShow: function() { var hid = function() { x.getTip().hide();

attempting to make enter button 'clickable'

谁说胖子不能爱 提交于 2019-12-13 04:32:48
问题 I want to make a 'search' button clickable upon clicking enter. this is my html <input type="text" runat="server" id="txtSearch" onkeypress="searchKeyPress(event);" <input type="button" runat="server" style="padding:5px;" id="butSearch" onserverclick="butSearch_Click" value="Search" disabled/> This is the javascript I am using function searchKeyPress(e) { if (typeof e == 'undefined' && window.event) { e = window.event; } if (e.keyCode == 13) { document.getElementById("butSearch").click(); } }

jquery asp.net, stopping postback

喜你入骨 提交于 2019-12-13 04:32:14
问题 I have a text box and I want the user to be able to type in the TextBox and when they hit enter, I want jQuery to make a ajax call to a web method. The problem is, when user hits the enter, the method is called but then the page refreshes due to the return. I've tried using return false but with no results. Here is the code: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <script type="text/javascript" src="Scripts/jquery

div onmouseout does not work as expected

[亡魂溺海] 提交于 2019-12-13 04:19:47
问题 Text and sample code adapted from http://www.webdeveloper.com/forum/archive/index.php/t-65078.html, may not reflect actual question: I have a div and then a div with a nested table inside it: also there is some div outside the parent div. <div onmousemove="move()" onmouseout="out()"> <div id="dvRep"> </div> <table> <tr><td>ITEM 1</td></tr> <tr><td>ITEM 2</td></tr> <tr><td>ITEM 3</td></tr> <tr><td>ITEM 4</td></tr> <tr><td>ITEM 5</td></tr> </table> </div> <div id="divChartPopupMenu"> Hide me. <

jQuery - How to execute script as soon as we know true height (with images) of ajax-loaded element?

不问归期 提交于 2019-12-13 04:10:36
问题 Say I have a page index.html where my scripts are running, and a page content.html which is a very large, rich document full of images and styled text. I'm loading the contents of content.html into <div id="container"></div> on my index.html with: $.get("content.html", function(data, textStatus, jqXHR) { $("#container").html(data); contentLoadedCallback(); }); In the above example, contentLoadedCallback() is called as soon as the content html is inserted into the container. But what if I want

get opened pages/tabs with mootools

瘦欲@ 提交于 2019-12-13 03:51:42
问题 i have a site that need to know if the user have other pages/tabs opened just to make actions in them (like closing them, redirect etc..). i'm not talking about popups, i'm talking about content opened in a new page tab manually by the user. so basically i need a method to get a list of tabs/windows opened on my domain and be able to access the content in them (as all is the same domain, there should not be any security problems) exist something like that? Regards, Shadow. 回答1: I think it

javascript :Object doesn't support this property or method

拟墨画扇 提交于 2019-12-13 03:38:41
问题 In my jsp page, I have in the tag, the following code: <script type="text/javascript" src="<%=request.getContextPath()%>/static/js/common/common.js"></script> <script type="text/javascript"> // Function for Suppressing the JS Error function silentErrorHandler() {return true;} window.onerror=silentErrorHandler; </script> If there is some javascript executing on the jsp page after this, then I guess silentErrorHandler() will have no effect. i.e. the error will still show on page. IS this

javascript On change event is not firing in Safari after selecting the dropdown value

不羁的心 提交于 2019-12-13 03:23:21
问题 I have a dropdown in my page. Whenever a user is selected the option it should open a new window with the selected index url. the below code is working in all browsers except safari. Any idea to solve this issue..? <form> <select class="searchboxproduct" style="width: 243px;" name="URL" onchange="window.open(this.form.URL.options[this.form.URL.selectedIndex].value)"> <option value="">select</option> <option value="www.gmail.com/">Gmail</option> <option value="www.google.com">google</option> <