javascript

I want to iterate the Table using .childNodes, then find the <B> tag. My code doesn't work!

Hi, I have a problem in my code. I want to get the b tag that has the style color silver using Javascript. I tried using the tagName === "B" but it didn't work. I figured that the B tags are not children of the rowData class. <tr class="rowData"> <td style="padding: 0pt;"> <table><tr> <td> <b style="fo...

reorder items algorithm

I've got an html table thus: up | dn [ ] Item 1 [x] Item 2 [ ] Item 3 [ ] Item 4 [x] Item 5 [ ] Item 6 [ ] Item 7 If 2 & 5 are checked and I click up, the result is: up | dn [x] Item 2 [x] Item 5 [ ] Item 1 [ ] Item 3 [ ] Item 4 [ ] Item 6 [ ] Item 7 If I click dn, the result is: up | dn [ ] Item 1 [ ] Item 3 [ ] ...

Is there a way to change the contents of elements when they are selected?

Is it possible to change the contents of elements when they, or a part of the text within them, is selected then reverting them back when they are deselected? The aim being that when they are copied to the clipboard the alternate value is copied. The html looking something like this: <p>Today is the <span class="date" value="18/03/200...

CSS text-decoration: reverse

I'm surprised that there is no "text-decoration: reverse" in CSS as it seems very awkward to achieve using JavaScript. I.E. set the element's foreground and background color to the background and foreground of the parent respectively. I noticed JavaScript techniques for that here Surely it's not that complicated? ...

Regex that matches numeric with up to 2 decimal places

I am after a regex that will match numeric values with up to a user defined number of decimal places. Currently I have /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/ which will allow as many places as input but I would also like to sometimes allow 2 for currency or 4 or more for other input. The function I am building is var isNumeric...

Can you combine replace_html with a visual_effect in Rails RJS?

I'm developing a website with Ruby on Rails and I have a div with some content. After clicking a link I want that content to get replaced with some other stuff. This works fine with replace_html and rjs. However, I'd prefer there to be a slight fade/appear (crossfade?) transition between the old and new content. Also the div will be ...

Javascript array conversions

I have a function (that I can't change) that queries data from a database and returns it in a variable that shows as the following format if I display it as text: var outputdata= [ { itemA: 'M0929', itemDate: new Date(1950,03-1,25,0,0,0,0), itemID: 'JDR12' }, { itemA: 'X0121', itemDate: new Date(1983,07-1,07,8,0,0...

Can JavaScript load XML data from a third-party domain?

Can JavaScript load an RSS XML feed from Yahoo? Is client-side JS allowed to access 3rd-party domains? ...

How can I obtain the local time in jQuery?

I am using jQuery and I need to get the local time for Germany. Anyone coming to my website from any country should be able to know what time it is in Germany. If the time is between 0:00 and 12:00 I need to make an alert reading: "Good Morning". If the time is between 12:00 and 17:00 I need to make an alert reading: "Good Afternoon"....

Does jQuery have any functions to scroll the client to the bottom of the view port?

I want to animate a scroll to the bottom of the viewport with jQuery. Is there a plugin available which isn't overkill (i.e. without a huge feature set for this small task); Is there a plugin available or a way to do this natively with jQuery? ...

javascript regexp, validating date problem

Hi there, I have some code for validating date below: function validateForm() { var errFound = 0; //var patt_date = new RegExp("^((((19|20)(([02468][048])|([13579][26]))-02-29))|((20[0-9][0-9])|(19[0-9][0-9]))-((((0[1-9])|(1[0-2]))-((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30)))))$"); var pat...

JS Framework incorporated with CruiseControl

Are there any JS Framework that can be incorporated with CruiseControl.NET ? Or what's the best JS Framework that have an intensive unit testing feature. ...

handling asynchronous calls

How do I handle asynchronous calls to make sure they do not overlap? This is my scenario--- I have a loop and within the loop I make a call to a google API and specify a call back function. My callback function processes the results and writes the output to a table. However I have noticed that the results being written to the table ...

the contents of iframe doesn't print in google chrome

i have a page which calls some contents in an iframe and when i try to print the contents of the iframe it prints blank in google chrome , but its working fine in mozilla and explorer how can i make it work in google chrome also? ...

Filling the text area with the text when a button is clicked

In ASP.net, I need the code to fill the text area (in the form) when a button is clicked. Can you help me through by showing a simple .aspx code containing the script tag? In trying to solve this, I get the following error: This .aspx document does not contain the definition of addText() function My .ASPX code is below. <%@ Page Lan...

Better to Javascript redirect OR form submit?

I'm doing a select box navigator and wondering if it's better to do a javascript redirect or submit a form and redirect from there. Pros and cons of each? ...

Why is browser sniffing so bad?

You hear it all over the place: using javascript to sniff the user agent string to detect browser versions is a Very Bad Thing. The latest version of jQuery has now deprecated its $.browser object in place of $.support. But what should I do if there's a bug or problem which is only affecting IE and not the other browsers, and I'm not sur...

Javascript Problems

I am using Javascript to store values in a stack, the problem is that the stack value remains active until the page is refreshed. When the page is refreshed the value in the stack value gets set to 'Undefined'. Is it better to implement a place to permanently store the stack values? Then even if the page is refreshed the old stack value...

How can I trim the leading and trailing comma in javascript?

I have a string that is like below. ,liger, unicorn, snipe, how can I trim the leading and trailing comma in javascript? ...

Regex to find all methods in a piece of code

Hi, I am trying to write a regex to match all the javascript method definitions in a constructor string. //These two should match this.myMethod_1 = function(test){ return "foo" }; //Standard this.myMethod_2 = function(test, test2){ return "foo" }; //Spaces before //All of therse should not //this.myMethod_3 = function(test){ return "f...