I’m using this method to make artificial ‘hashmaps’ in javascript. All I am aiming for is key|value pairs, the actual run time is not important. The method below works fine. Are there any other ways to loop through this? I run into a problem where this outputs a bunch of undefined keys after the first key, when the array only
Tag: javascript
How to fire mouse wheel event in Firefox with JavaScript?
I’m trying to do automated testing with WebDriver, but it currently has no ability to simulate mouse wheel events. As a workaround I’m trying to fire these events with JavaScript instead. I’m doing all my wheel experimenting on a straight HTML page right now, not within the WebDriver framework. I’m specifically trying to fire a mouse wheel event on a
How to negate code in “if” statement block in JavaScript -JQuery like ‘if not then..’
For example if I want to do something if parent element for used element hasn’t got ul tag as next element, how can I achieve this? I try some combination of .not() and/or .is() with no success. What’s the best method for negate code of a if else block? My Code I want to achieve this Pseudo Code: Answer You
Return string without trailing slash
I have two variables: I want to do something like this How do I do this? Answer Try this:
Get Line co-ordinates in Javascript
I am drawing lines using Canvas (HTML 5), since lines/shapes are not stored as objects in Canvas, I cannot attach unique events to it (eg onmouseclick) I wish to attach a onmouseover event to a line, is it possible by getting to know if the mouse if over a particular line (using its 2 X and 2 Y co-ordinates) in
Convert hyphens to camel case (camelCase)
With regex (i assume) or some other method, how can i convert things like: marker-image or my-example-setting to markerImage or myExampleSetting. I was thinking about just splitting by – then convert the index of that hypen +1 to uppercase. But it seems pretty dirty and was hoping for some help with regex that could make the code cleaner. No jQuery…
“google is not defined” when using Google Maps V3 in Firefox remotely
Here’s my conundrum: I have a page that uses Google Maps V3 and jQuery. It all worked well locally in FF5, Chrome and Safari. Once I uploaded to a web site, I get a “google is not defined” error on the first line that I try to use a google object It only occurs in FF and only occurs remotely
Removing all script tags from html with JS Regular Expression
I want to strip script tags out of this HTML at Pastebin: http://pastebin.com/mdxygM0a I tried using the below regular expression: But it does not remove all of the script tags in the HTML. It only removes in-line scripts. I’m looking for some regex that can remove all of the script tags (in-line and multi-line). It would be highly appreciated if
how to disable buttons based on a condition in jsp?
how can I disable a button by checking a condition in my jsp? If true,then the button is enabled,if false,then the button is disabled. The condition would be checking the value of a variable. I know how to disable a button using javascript, but to use it along with the condition in jsp is what I’m not able to figure
Is it possible to alter a CSS stylesheet using JavaScript? (NOT the style of an object, but the stylesheet itself)
Is it possible to alter a CSS stylesheet using JavaScript? I am NOT talking about: I AM talking about altering: besides doing something dirty (which we haven’t tried yet btw), like creating a new object in the head, innerHTML a style tag in there, etc. Although this, even if it did work, would pose a few issues as the style