window.location() not working, not opening page

I have a submit button with a onClick: <div id=”messageDiv”> <form> <textarea name=”message” rows=”10″ cols=”20″></textarea></textarea> <br /><br /> <input type=”submit” value=”Send” onClick=”sendmail()”> <input type=”reset” value=”Reset” name=’reset’> </form> </div> then I have my sendmail: function sendmail() { window.location.href = “”+mailid; window.location(‘’+mailid); //return true; } mailid is a global variable that gets set in another JS function […]

Execute javascript code straight before page submit

There are a few similar questions to this but none quite the same. I want to know if there is an event that can be used to execute some JS before a page is submitting (i.e. POSTed).

ASPNetSpell Spell Checker integrated with CKEditor 3 doesn't work with Chrome

I’ve been working to integrate ASPNetSpell’s spell checker ( into CKEditor ( I’m seeing some unsettling behavior between IE 8+, FireFox 12 and Chrome 18.0.1025.152m. The short of it seems to be that ASPNetSpell can’t find the instance of CKEditor in Chrome, but in IE and Firefox it can. I’ve followed the recommendation in ASPNetSpell […]

Get order of list items in a jQuery Sortable list after resort

I have a list on my website. I’m using jQuery’s sortable tutorial to give users the ability to change the order of the list items. The trick is I would like to capture the order of the items immediately after a resort and assign the order values to hidden form elements which would be […]

How to check if an element is in the view of the user with jquery

I have a very big draggable div in my window. This div has a smaller window. <div id=”draggable-area” style=”width:500px;height:500px;overflow:hidden”> <div id=”draggable” style=”width:5000px;height:5000px”> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> …. </ul> </div> </div> How can I know if the li element is visible in the user viewport (I mean really visible, not in the overflow area)?

Callback function after tooltip / popover is created with twitter bootstrap?

I want to manipulate a tooltip or popover after it is created with twitter bootstrap. As far as i know there isn’t a build in way to do this. $(‘#selector’).popover({ placement: ‘bottom’ }); For example lets say i want to move the created tooltip up 5px and left 5px from it’s calculated location. Any ideas […]

How to do a JavaScript HTML 5 Canvas image “page flip” like you commonly see in Flash?

Has anyone tried recreating the page flip effect with images like you commonly see in Adobe Flash with JavaScript and HTML 5’s canvas tag? Are there any frameworks or JQuery plug-ins that do this type of effect? The page flip in Flash allows you to grab a corner of the simulated book page and flip […]

Generate Random Color distinguishable to Humans

I am trying to randomly generate a color in hex in javascript. However the colors generated are almost indistinguishable from eachother. Is there a way to improve it? Here is the code I am using: function randomColor(){ var allowed = “ABCDEF0123456789”, S = “#”; while(S.length < 7){ S += allowed.charAt(Math.floor((Math.random()*16)+1)); } return S; } I […]

Why does setting textContent cause layout thrashing?

This blog post suggests that textContent is preferable to innerText for avoiding layout thrashing. But it is focused on retrieving an element’s text; for setting element text, the opposite appears to be true — at least in the following example. This example uses innerText and produces no layout thrashing: <style> #test { background-color: blue; float: […]

In what Javascript engines does Function.prototype.toString not return the source code of that function?

EDIT: To be explicit, I am not looking for advice or opinions on the qualitative merit of the various issues implied by the functionality in question — neither am I looking for a reliable solution to a practical problem; I am simply looking for technical, verifiable answers to the question in the title. I have […]