javascript

How to select nested dom elements.

Hi, I am looking for a way to collect all <a> tags and load then in an array using Mootool 1.1 or pure javascript. <ul class="menu"> <li> <ul> <li><a href="#">Group One</a> <ul> <li><a href="#">I want</a></li> <li><a href="#">I want too</a></li> </ul> </li> <li><a href="#...

Change Table Row background color on Timer Event using jquery

Hi Everyone, Could someone help me please with my problem below? I basically have this markup coming from my JSP. I add class in each row and I want have a blinking effect on each row. <table> <tbody> <tr class="blinkYellow"> <td>Col 1</td> <td>Col 2</td> <td>Col 3</td> </tr> <tr> <td>Col 1</td> <td>Col 2</td> ...

Java or any other language: Which method/class invoked mine?

I would like to write a code internal to my method that print which method/class has invoked it. (My assumption is that I can't change anything but my method..) How about other programming languages? EDIT: Thanks guys, how about JavaScript? python? C++? ...

jQuery submit form with AJAX problem

Here is my jQuery code: <script type="text/javascript"> //<!-- $(document).ready(function() { $('input[type="submit"]').click(function() { $.ajax({ type: 'POST', url: $('form').attr('action'), success: function(data) { // } }); ret...

How can I tell a widget to maximize to fill the whole space available?

I'm developing a widget for mobile phones using the Vodafone Mobile Widget Platform and I'm trying to get it to fill the entire screen. Using height and width to 100% doesn't seem to work as expected. Anyone know what to do? ...

Can I add a unique id attribute to a td from jquery?

I have a table being populated and I would like the td id to be the id number for the data that was returned. How do I assign an id to a td from jquery? var $tr = $('<tr><td class="name"></td></tr>').insertAfter('#newTable tr:last'); $tr.find('.name').html(data.Name); //How do I assign data.id to <td class="name"> ? ...

Opening HTML link in new window

I've got a table that shows details about some products, which are stored in the database. These details are Item Name, Price and submit Date. Item Name Price Submitted on Laptop £30 12/04/10 guitar £5 12/05/10 If I click on Laptop I want to see all details such as Title, Price, Description, Picture, Contact n...

Detect "overall average" color of the picture.

I have a picture (jpg file, for example). I need to know "overall average" the color of the picture. I mean the prevailing color in this picture. I can not strictly furmulate my task. I will cite an example: (Image above: at the top - the original image, at the bottom - the "overall average" color which is associated with picture) ...

ExtJS - saving data in multiple stores

I have a three stores (Ext.data.JsonStore) inside a subclass of Ext.Window. I would like to call save() on all of these, display a wait mask until complete, and then close the window or handle an error. Is there a way I can do this without ending up with something really messy? I was considering doing this by calling save() on the seco...

jQuery get THIS form input

I am trying to get the values of multiple form inputs, but the problem is I have several identical forms on the same page and only want to get the inputs from the form that was submitted, so I am using the 'this' keyword. This is my code: $('form.contact_form').submit(function(e) { var fname = $(this).children('input.fname').val(); ...

Dynamic select list (JavaScript)

Hi, Does anyone know how I could get the select options in the following to be populated from a SQL DB?: var cell2 = row.insertCell(1); var sel = document.createElement('select'); sel.name = 'selRow' + rowCount; sel.options[0] = new Option('text zero', 'value0'); sel.options[1] = new Option('text...

IE stop script warning

Only in IE I get a warning when loading my site containing javascript saying that its causing the page to run slowly (and asking if I want to stop it). I've seen other posts about this and I've looked for any long running code or infinite loops etc. The weird thing is, when I select 'No' (to not terminate the script) the page immediate...

Why does setTimeout() "break" for large millisecond delay values?

I came across some unexpected behavior when passing a large millisecond value to setTimeout(). For instance, setTimeout(some_callback, Number.MAX_VALUE); and setTimeout(some_callback, Infinity); both cause some_callback to be run almost immediately, as if I'd passed 0 instead of a large number as the delay. Why does this happen? ...

JQuery & cloning huge table

Hello Gurus: I have a huge table, 1 row with around 2600 columns (it's a Gantt chart) What I'm trying to do is to clone this table and copy it 100 times to somewhere on the page (instead of redraw the table 100 times as it seems to be less efficient, I can be wrong though) var $templateTable = $("div#GTT_TLayout").clone(); //there ar...

How can i use the different view modes of a mobile widget?

I'm trying to make a mobile application using the Vodafone Mobile Widget Platform and I've seen they support different view modes, like... docked, floating, etc... How can make use of them? Also, is there any way to detect when a widget is docked or is floating? ...

How to check if a html control exists?

How do I check if an HTML control exists? This is my code: var id = ... if(document.getElementById(id)!=null) { //do something } if the html control is radio doesn't work. How is this done? ...

Javascript Mobile Redirecting

I am using the JavaScript version of the mobile redirect from: http://detectmobilebrowser.com/ However I want to avoid infinite redirection loops. On the mobile version we have a link back to the full desktop version and I don't want someone to click it and then just redirect back to the mobile main page. Thoughts/Ideas? ...

Filter the HTML table and result should be in a HTML table

I am new to programming, i am having a html page with 5 columns and 20 rows and an input field above the table. When i search for a date from the table, the result should be in a table format. See the example below. chandru, chandu | george, john | ohn, chandu | james, jones | Gita, sham | _______________________________________...

JavaScript img onLoad and closures - why does this code trigger an infinite loop?

I have some Google Maps JS that plots a number of markers on a map. However, when loading the markers I noticed that the images were not loading in time and so the markers were not being placed. To get around this I modified my function that returned a map marker as follows: function newGoogleMapPin(type){ var imgpath = "img/gmapico...

jquery drag and drop help

I have this code for a drag and drop portion of my site, I use this HTML first off, <li class="drag_check"> <input type="checkbox" value="Y" class="cv_choice" name="cv_file[<?=$rslt['code'];?>]" id="inp_cv_<?=$rslt['code'];?>" /> </li> and then this code for the drag and drop: var cv_file = new Arr...