yui
Execute function before refresh
window.onbeforeunload = function(event) { return confirm(“Confirm refresh”); };
Need to find height of hidden div on page (set to display:none)
You need to make element’s parent visible for that one very short moment while you’re getting element’s dimensions. In a generic solution, all ancestors are usually traversed and are made visible. Then their display values are set back to original ones. There are performance concerns of course. We considered this approach in Prototype.js implementation but … Read more
What’s this UI pattern called?
I don’t think there’s an “official” name, typically called “dual list” or.. even more commonly known as “the thing where you have two boxes and you can move things in between”. Here’s a jQuery Plugin for this: https://github.com/Geodan/DualListBox
What http status code is supposed to be used to tell the client the session has timed out?
Best I can suggest is a HTTP 401 status code with a WWW-Authenticate header. The problem with 403 requests is the the RFC 2616 states “Authorization will not help and the request SHOULD NOT be repeated.” (i.e. doesn’t matter if you are authenticated or not, you are not going to get access to that resource, … Read more
Dynamically add data to a javascript map
Well any Javascript object functions sort-of like a “map” randomObject[‘hello’] = ‘world’; Typically people build simple objects for the purpose: var myMap = {}; // … myMap[newKey] = newValue; edit — well the problem with having an explicit “put” function is that you’d then have to go to pains to avoid having the function itself … Read more
What are the typical reasons Javascript developed on Firefox fails on IE? [closed]
Please feel free to update this list if you see any errors/omissions etc. Note: IE9 fixes many of the following issues, so a lot of this only applies to IE8 and below and to a certain extent IE9 in quirks mode. For example, IE9 supports SVG, <canvas>, <audio> and <video> natively, however you must enable … Read more
How to get child element by class name?
Use querySelector and querySelectorAll var testContainer = document.querySelector(‘#test’); var fourChildNode = testContainer.querySelector(‘.four’); IE9 and upper
Set Value of Input Using Javascript Function
Try… for YUI Dom.get(“gadget_url”).set(“value”,””); with normal Javascript document.getElementById(‘gadget_url’).value=””; with JQuery $(“#gadget_url”).val(“”);