javascript

How can I force Javascript garbage collection in IE? IE is acting very slow after AJAX calls & DOM manipulation

I have a page with chained drop-downs. Choosing an option from the first select populates the second, and choosing an option from the second select returns a table of matching results using the innerHtml function on an empty div on the page. The problem is, once I've made my selections and a considerable amount of data is brought onto ...

Having trouble sorting using Ruby on rails and acts as list, position won

I have Groups that has_many projects. I also created an order view that is similar to my Show view. The reason for creating an additional view is that I am using the Group#show view for a primary display in my site. So I have the following in my Groups_Controller def order @group = Group.find(params[:id]) end def sort @group...

Getting the correct node

Hello I have this structure in my dom: <label>London<input type="checkbox" name="London"></label><br> <div class="innerpost"> <label>N1 2AB<input type="checkbox" name="N1 2AB"></label><br> <label>E1 1AB<input type="checkbox" name="E1 1AB"></label><br> </div> I need a way to select the div from the first checkbox. Something like ...

javascript increment index in funciton

I'm just trying to figure out how to create an index inside a function so I can keep track of the items its generating and I'm not sure how to do this seems like I should know this.. addLocation(options,location) funciton addLocation(options,location){ $('#list').append('<li class="location"><div>'+location.label+'</div>'+ ...

Drop down menus and pathetic art of styling

Sorry folks, I must be brain-dead or something but I can't get the styling on these drop-down menus to cooperate. I have the color and the font right, but I have unwanted spaces between the list elements and the a and the a:hover sizes should be the same. I would appreciate some help getting this to work correctly. Here is the page ...

javascript - change the alpha of an image

How can I change the alpha of an image in javascript? Also, what browsers support this? ...

jQuery - Can I animate css properties? Background-image particularly

I know I can fade in and out divs and elements, but can I animate properties as well? I thought about this just now when changing background-image property of a certain div. And thought it'd be cool if the background image was faded in as well ;) Here's the code I'm using to replace background image. But can it be animated? var origina...

Override browser "Find" feature

I'm wondering whether it's possible to use JavaScript to intercept or prevent the user from using the browser's "Find" feature to find text on the page. (Trust me, I have a good reason!) I'm guessing the answer is "no," beyond the obvious intercepting Cmd/Ctrl+F. A second-best solution would be to intercept the text highlighting that th...

Adding nice colors to events in FullCalendar (jquery)

In my calendar I want to colour each event in a different colour. Is there currently a way to send to the full calendar, in the JSON it expects a value for a colour? FullCalendar ...

Help with shopping cart in javascript

Hey guys, (question edited) What I am trying to achieve is this: I want button where I can add my item to the shopping cart e.g AddToCart() so I can add my items with the number of quantities that the person will want. To do this I need global arrays like sum, quanitity and name. Except the way I have done it does not have this and I'm...

Regex with dynamic <textarea>

How can I do this with the JS replace() method: Make \n\n change to <p>$1</p> Change single \n to <br> Then back again. I think I have this part, see the JS at the bottom. Example HTML: <p>Hello</p><p>Wor<br>ld</p> The <textarea> would look like: Hello Wor ld So, how can I achieve this? It's an AJAX form where when you click o...

.focus() doesn't work on an input while orher attributes works

I have a classic table / thead / tbody structure, which I add a line at the end of the tbody. The line contains only an input element. The code works in Firefox 3.6 but not in Chrome v5 or IE8. I'm using jQuery 1.4.2. Does not work: $("#" + AJAX_ID).parent().find('tr:last > td:nth-child(2) > input').focus(); Does work: $("#" + AJAX_ID)...

What does document.body.offsetHeight do before window.print() ?

Sniffing gmail's Print all link source code, there's something like this: <script> function Print(){document.body.offsetHeight;window.print()}; </script> </head> <body onload="Print()"> What does document.body.offsetHeight do? ...

Automated browser testing: How to test JavaScript in web pages?

I am trying to write an application that will test a series of web-pages programmatically. The web pages being tested have JavaScript embedded within them which alter the structure of the HTML when they complete execution. It is then the goal to take the final HTML (post-execution of the embedded JavaScript) and compare it against a know...

JavaScript eval() "syntax error" on parsing a function string

I have a bit of JavaScript code that is specified in a configuration file on the server-side. Since I can't specify a JavaScript function in the configuration language (Lua), I have it as a string. The server returns the string in some JSON and I have the client interpret it using a clean-up function: parse_fields = function(fields) {...

In Titanium how do I fetch data from inside a TableViewRow?

I've added a ImageView and a Label to a TableViewRow, I've attached an on click event listener, so I can get the row, but how can I access the label inside of that row? Is there a way to find the objects added to the row object? ...

Checking JRE version inside browser

Basically, I'm wanting to figure out the best way to check the user's JRE version on a web page. I have a link to a JNLP file that I only want to display if the user's JRE version is 1.6 or greater. I've been playing around with the deployJava JavaScript code (http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.ht...

HTML5 Canvas: How to make a loading spinner by rotating the image in degrees?

I am making a loading spinner with html5 canvas. I have my graphic on the canvas but when i rotate it the image rotates off the canvas. How do I tell it to spin the graphic on its center point? <!DOCTYPE html> <html> <head> <title>Canvas test</title> <script type="text/javascript"> window.onload = function() { var drawingCan...

css style "bottom:0" in dynamic <div>

I have an absolutely positioned element at the bottom of a container element. The problem is that the content of the container changes dynamically (javascript). In FF it still works fine, but IE7 (didn't test any others) seems to calculate the position of the element relative to the top of the container on page loading, and then doesn't ...

Scroll iframe by mouse coordinates

It is possible to scroll an iframe by mouse coordinates on mouse move event? ...