javascript

Given a property, how to find to which object the property belongs?

I've got a few DOM elements, say text-field input A, B, C, and all of them have the property of 'onclick'. How do I find to which object a particular 'onclick' belongs? ...

Google maps: place number in marker?

How can I display a number in the marker on a google map? I want to do server side clustering and I need to display how many points the cluster represents. ...

How to use javascript class from within document ready

Hi, I have this countdown script wrapped as an object located in a separate file Then when I want to setup a counter, the timeout function in the countdown class can not find the object again that I have setup within the document ready. I sort of get that everything that is setup in the document ready is convined to that scope, howeve...

Custom Alignment and Backgrounds Through Greasemonkey

I'm trying to implement something in greasemonkey and it is giving me a fair bit of trouble as I can't get it to work. I frequently use Wolfram Alpha (http://wolframalpha.com) for a lot of things. They have recently updated the home page with a new style. There are settings that you can edit on this page (http://www.wolframalpha.com/hom...

Simulating click with javascript on document

Is it possible to simulate a click on a webpage using javascript but without defining a specific element, but rather just specifying the document? I would have liked to do something like this, and if the location happens to have a link, then this will be pressed: function simulateClick(x, y) { var evt = window.createEvent("MouseEv...

PacMan on Google homepage, how is it implemented?

I was wondering, how was the PacMan game on Google.com implemented? Javascript? ...

jquery: Writing a method

This is the same question as this: http://stackoverflow.com/questions/2890620/jquery-running-a-function-in-a-context-and-adding-to-a-variable But that question was poorly posed. Trying again, I'm trying to do something like this: I have a bunch of elements I want to grab data from, the data is in the form of classes of the element chi...

Just a small problem regarding javscript BOM question

The question is this: Create a page with a number of links. Then write code that fires on the window onload event, displaying the href of each of the links on the page. And this is my solution <html> <body language="Javascript" onload="displayLink()"> <a href="http://www.google.com/"&gt;First link</a> <a href="http://www.yahoo.com/"&g...

addEventListener using apply()

I'm trying to invoke addEventListener() using apply() method. The code is like: function rewrite(old){ return function(){ console.log( 'add something to ' + old.name ); old.apply(this, arguments); } } addEventListener=rewrite(addEventListener); It doesn't work. The code works for normal JavaScript method, for...

how to test if a string is a valid UTF16 string?

I am using mongodb and javascript to do some string processing. Now I got some error like: Sun May 23 07:42:20 Assertion failure JS_EncodeCharacters( _context , s , srclen , dst , &len) scripting/engine_spidermonkey.cpp 152 0x80f4f7e 0x80f8794 0x811525b 0x811a953 0x8119fc4 0x8111bc5 0x81b408e 0x81c4ee7 0x81b4a10 0x817a881 0x817a7...

nextSibling issues...

Ok, this has been killing me all night, I mean I've been working on this code for atleast 8 hours now. What is the problem with this, argggg. I am trying to update all <span id="column_[row index number]_[column index number]_[layout position number]"> to increment it by one up until the next id="row_[row index number]" tr element, The...

Searching for a semantic syntax highlighter in Javascript

OK, I know, there are literally dozens of already available syntax highlighters out there. But I want one specifically, that implements line numbers through <ol/> lists. And that reduces the number of possible candidates to one, Lighter.js. Unfortunately, that is MooTools based, and since I decided some time ago to use jQuery, I don't wa...

Javascript file for single domain

How can I make a javascript file only work on a single domain. I'll compress this file and when somebody tries to use it by copying my web site or just the javascript file, it won't work and give alert. Here is an example. I downloaded all files but when try to view it gives an alert that says I need to buy it (what exactly I'm going t...

Hotkeys in webapps

When creating webapps, is there any guidelines on which keys you can use for your own hotkeys without overriding too many of the browsers default hotkeys. For example i might want to have a custom copy command for copying entire sets of data that only makes sense for my program instead of just text. The logical combination for this woul...

Initialize Tab Event in JQuery UI

Is there any initialize event in Jquery UI Tabs , which executes only once when particular tab loads ? As show function in Jquery UI tabs executes every time when tab gets load , i want an event that executes only once.. ...

Looping login with Facebook JS SDK and Rails

I'm using the Facebook JS SDK for single-sign with my rails app. I translated the php code from the Facebook example (at the bottom of the page under "Single Sign-on with the JavaScript SDK") into ruby. This appeared to be working great but I've noticed one user that gets continual redirects when trying to login. The logs look like: Pr...

does jquery have an equivalent of dojo.connect() ?

Forgive my ignorance as I am not as familiar with jquery. Is there an equivalent to dojo.connect() ? I found this solution : http://think-robot.com/2009/06/hitch-object-oriented-event-handlers-with-jquery/ But there isn't disconnect feature ! Do you know other solution in jquery ? There are jquery.connect but this plugin not work in m...

Including JavaScript and CSS in a page (jQuery)

I recently came across the includeMany jQuery plugin to include external JavaScript and CSS files into a page. Although it was released in early 2009 there are NO references in blogs or elsewhere. I wonder if it's usable? What is the experience using it? ...

Converting HTML TAG Object to JSON Object

Hi, I want to convert the html tag objects to json object in the javascript in order to send them to the server from the javascript. As i have to save these objects at the Ruby on Rails server. These HTML objects is the canvas tag object and the graphics objects created using CAKE API. I have used the stringify function but it is not...

Display label character by character using javascript

Hi, I am creating Hang a Man using PHP, MySQL & Javascript. Every thing is going perfect, I get a word randomly from DB show it as a label apply it a class where display = none. Now when I click on a Character that character become disable fine which i actually want but the label-character does not show. My code is: <link href="style.cs...