Skip to content
Advertisement

Bitshift in javascript

I’ve got a really big number: 5799218898. And want to shift it right to 13 bits. So, windows-calculator or python gives me: 5799218898 >> 13 | 100010100100001110011111100001 >> 13 70791 | …

onclick event in the javascript

I am very new to javascript I know that you can add an onclick=”” event to a html element… but is it possible in the javascript itself to declare that when someone clicks on x element an event is triggered? Answer Make sure that you either run this after the element already exists (scripts at the bottom), or when the

Changing window.location.href in Firefox in response to an onunload event

I have a strange JavaScript problem using window.location.href, which apparently only affects Firefox (I’m using 3.6). Normally window.location.href would not be read-only, and this works perfectly in Firefox: However, when I call a function in response to an onunload event (<body onunload=”testThis();”>), this doesn’t work as expected: In both cases, the alert displays the current location of the page in

Waiting for image to load in JavaScript

I’m making an Ajax call which returns me some info including an image path. I prepare all this information in my HTML which will be displayed as a kind of popup. I just toggle the visibility of by popup div from hidden to visible. To set the position of my popup div, I have to […]

jQuery vs. javascript? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 9 years ago. Improve this question I recently stumbled upon some javascript forums (sadly, link is lost somewhere in the universe), where you could feel real hate

Mouse event weirdness

Here is the Greasemonkey script I’m working on (source below): http://userscripts.org/scripts/show/69722 You can test it out on this page: http://forums.whirlpool.net.au/forum/35 Hover over a thread title and a div appears with a preview. The weird thing is, when you move your mouse around on the div, the mouseout event is getting fired for some reason. Anyone have any ideas as to

What is the non-jQuery equivalent of ‘$(document).ready()’?

What is the non-jQuery equivalent of $(document).ready()? Answer This does not answer the question nor does it show any non-jQuery code. See @ sospedra’s answer below. The nice thing about $(document).ready() is that it fires before window.onload. The load function waits until everything is loaded, including external assets and images. $(document).ready, however, fires when the DOM tree is complete and

Advertisement