javascript

JavaScript/jQuery: Follow path over page

I need to make an animated gif 'fly over a page and follow a path. I'm thinking of using jQuery but would I be right in thinking the only way to do it is manually calculating the percentage of width/height where the shape layer should be placed, then using absolute positioning is the only way to do this? I know there are some amazing jQu...

Substring with reverse index

How can I extract "456" from "xxx_456" where xxx is of indefinite length? ...

Youtube API playVideo doesn't work

Anyone had instance where onYouTubeplayerReady works, i.e. id is passed, but the object isn't working? Here is my code: <div id="ytplayer"></div> <script language="javascript"> var vid; function onYouTubePlayerReady(id) { vid = id; } var currWidth = 320, currHeight = 265; $("#ytplayer").html($.flash.create({ "sw...

Find class in table row

Hello. Take a look at this table: <table cellpadding="0" cellspacing="0" class="order_form"> <tr> <th>Amount</th> <th>Desc</th> <th>Price</th> <th>Total</th> </tr> <tr> <td><input type="text" class="order_count" /></td> <td> <span class="order_desc">Middagstallerk...

jQuery Validation Plugin: Invoke errorPlacement function when onfocusout, keyup and click

Hi, I am using the jquery validation plugin and want to use the errorPlacement function to add error messages to the fields title attribute and display just a ✘ next to the field. This works great when the form is submitted with the submit button but when any of the following events are triggered: - onfocusout - click - onkeyup The ...

Can someone explain how JSON parsers work without using eval at all?

I can't comprehend how it works without using eval - what's the secret behind this? Edit: Could someone present a trivial example of how the tree structure is converted to an object? ...

Javascript: prototype of Number

var x= 1; Number.prototype.test = function () { return this }; x.test() === x.test() // false Why does the === test return false? ...

Editing clipboard data when copying/pasting from a website

I have seen a few sites now where if you highlight text of an article, copy it, and then paste in they can add more text to it. Try copying and pasting a section of text from an article at http://belfasttelegraph.co.uk/ and you'll see what I mean - they add a link to the original article in the pasted text. How is this done? I'm assum...

How to save text to a div using JavaScript onmouseout

Good morning all. I have a div that I'm able to save text to when I click a save button but what I would like is if the text would just automatically save on an onmouseout event. For example: I have a div and two buttons (Save and Cancel). The user is currently able to mouse over the current text data inside the div, click on the text a...

Client-Side validation prvent Manually Postback by JavaScript eval()

Hi Folks I encouter some postback issue when using GetPostBackEventReference. Here is the Scenario: I have a javascript modal popup dialog and got a button in this modal dialog which used to select things (this is NOT an asp:button control) When this javascript dialog HTML button is clicked, it will call the MS AJAX web service call b...

How to match a regex pattern with a string by providing it a starting line no. and ending line no. within which the search should be performed?

I am writing a small windows script in javascript/jscript for finding a match for a regexp with a string that i got by manipulating a file. I know the line number for starting and ending of the search. But I am stuck at this position for a while. ...

Browser detection in javascript?

How do I determine the exact browser and version using javascript? Thanks ...

How to click a link that opens a sign in page on another page/window using Selenium IDE

Hello peeps, newbie here, i'm trying to get the value of a link using document.getelementbyClass/Name & then navigate to the page the link points to in a different window/tab using Selenium IDE. All suggestions gratefully received, thanks ...

(Jquery) Find the contents of a td from a selected tr

I am very new to JQuery, so appologies for what may be a very simple question. I have a table, and when i click on a row, i want the cells details to be filled into a form: so simple example <table id="table"> <tr><td class="field1">1 </td><td class="field2">2 </td></tr> </table> <input id="input" type="text" /> So the JQuery: $(d...

The fastest way to do a collection subtraction

I have two Sets. Set b is the subset of Set a. they're both very huge Sets. I want to subtract b from a , what's the best practice to do this common operation ? I've written to many codes like this , and I don't think it's efficient. what's your idea ? pseudo code : (this is not Java API) . for(int i = 0 ; i < a.size(); i++) { ...

Passing javascript to a function

Hello, Can I pass some Javascript to a function and then execute that Javascript from within the function, e.g. test("a = 1; b = 2; test2(a,b);"); function test(js) { // execute dynamically generated JS here. } Basically I have some code that is generated on the server and I want to pass that code to a JS function which when it has ...

firefox and javascript redirection

Hello there, I currently have a issue with firefox, where all other browser behave in the right way - even IE6! What I want to do is redirection to a subpage but leaving a history entry. There are 2 methods of rewriting the url as far as I know: window.location = "some.url"; - redirect to some.url with history entry window.location.r...

Combining JavaScript for Google Analytics with yours. (Asynchronous tracking.)

I have a JavaScript file which is loaded up at the end of my HTML page. Rather than adding the script code for asynchronous tracking for Google in yet another script I would rather combine the two scripts together. So instead of this: <html> ... <script src="myScript.js"> <!-- google analytics --> ...

Crossbrowser JavaScript + DOM documentation

I'm already aware of some browser-specific DOM documentation out there (Gecko DOM Reference for Firefox, MSDN for Internet Explorer and, of course, the ECMA and W3C specs) but I wonder if someone has compiled a good API reference that covers all common browsers (Firefox, Internet Explorer, Opera, Safari, Chrome...). The compatibility ta...

html refresh properties

Is it possible that the html page loaded, cannot be refreshed or reloaded by the user Thanks.. ...