javascript

Moving a DIV element to bottom of parent (as last child)

I'm trying to create a continually rotating banner for the top of the homepage of a site I'm developing. The best way that I can figure to keep it constantly in rotation is to take the first DIV (firstChild) and move it to the end of the stack once it's slid out of view. This: <div id='foo0'></div> <div id='foo1'></div> <div id='foo2'>...

How do I pass a list from aspx to javascript?

I have a list that I loop through to populate my table. I would like to pass a row of data to my javascript code at best. If not, I would like to pass the list and the id number to search for that row in the list. How can I do this? <%foreach(var item in Model.NewList) { %> <tr> <td><%=item.EntryDate.ToShortDateString() %></td>...

jQuery:: Do something after my set of functions has been executed. How to do?

Hey, I have a set of functions, and I want to do something, like show a loading animation, while these functions are running! and when they stop i want to show an alert, for example. All this on jQuery. Anyone has a tip? Some abstract code: //these are my functions: function a(number){number=number*2}; a(1); a(2); a(3); //While this ...

Multiple Select validation with jquery

Hi, I have this multiple select: <select id="sel_dest" name="dest_var[]" multiple disabled="disabled" size="10"> <option value="" selected>Destinatario</option> <option value="1"> ......... </select> how can i validate (required field) this select with jquery validation plugin? this code doesn't work: $("#register_form").validate({...

Javascript local variable works like class variable in window

I find this behavior of the global window object a little weird. var x = 10; function SomeClass(){ var y = 15; console.log("Someclass:y - " + this.y); //prints undefined } console.log("window.x: " + window.x); //prints 10 var obj = new SomeClass(); console.log("obj.y: " + obj.y); //prints - undefined Both variables x and ...

Returning a value from an iFrame in a popup to its parent window

Okay, ridiculously simple question, but it is doing my head in so any help would be appreciated! I need to return a value to a form field, the value is returned in an iframe that is in a popup window. So, I was thinking something along the lines of window.top.parent.form.field.value = 'new value' But that just gives me an error, any...

need to return true or false based on if value in text field is a specific number

I am looking to return true if the user entered 4 into the input field. function validateAddition() { if($("#validateAddition").val() == 4) { return true; } else { return false; } } <input value="" class="validate[required,onlyNumber,length[0,1]funcCall[validateAddition]] text-input" type="text" id="validateAddition" na...

Merge two JavaScript objects

Hello there, I've got a big JavaScript object literal I am reusing with very few modifications each time. It would be good to make a variable containing most of the object, then reference that each time I need it. But how can I do that? I tried to do this, but it didn't work: var settings = { legend: { enabled:false }, yAxis: { ...

Can you access a client's bookmarks using javascript with their permission?

I want to make it easier for a user to import bookmarks to my server. Is there anyway to automate this process using javascript to obtain the user's bookmarks? I'm assuming the browser has to have this feature - and I'm not sure if any browser does due to the inherent security risk. ...

Get image line co-ordinates for canvas

I just started to work with canvas. I need to simulate some image in pure canvas. image => tool => [1, 20, 80, 45.....] => canvas => canvas render image some picuture coordinates this picture but rendered(created) via canvas Are there any tools that help to get image lines coordinates (to map)? So, next, I could just use th...

JQuery- Adding attributes and params to an anchor

Hi I am new to JQuery. I have a link <a>href="http://www.ittesters.com&gt;&lt;/a&gt; I would like to be able to append the following to the end of the href ?iframe=true&width=70%&height=85% I also need to insert an attribute rel="prettyPhoto[iframes] I would like this to happen when the user clicks the link not on page load. I...

jqgrid - Set the custom_value of edittype: 'custom'

The custom_value of place_id is set to whichever row I click first. Subsequent clicked rows will all use that same value, regardless of their actual value. Why? example: place_id foo_name bar_value 10 blah abc 11 blah2 fgr click the row with the place_id of 10 and click "edit" and the form that appears will...

jQueryUI Draggable Helper Option Help

Is it possible to modify the clone helper that jQueryUI creates with draggable element? I don't want the exact clone as the helper, I just want something similar to it. ...

How to send the dyanmically generated <tr> to the next page

I am implementing a shopping cart site. When the user add the item, it will automatically add to cart with the product name and the price as a div. the code is below <div class="food_menu_add"><a href="#" id="ad"><img src="images/add.gif" onclick="addcart('Sliced Orange')" /></a></div> <table id="placehold"> </table> function addcart(n...

iFrame Javascript remove div child elements

I've created a calendar application for the website I'm building and I'm trying to remove a div element with javascript. The Process ------------------- * Calendar Page Loads * User clicks on an event * Event pops up with a Fancybox window which is passed the Container Div ID, and Event Div ID * User clicks Remove Event *...

Canvas in HTML5: Removing Previous Rectangle

I've been messing around with the canvas element in html5, and this is what I've got after a bit of experimenting function canvasMove(e) { var canvas = document.getElementById('game'); if(canvas.getContext) { var draw = canvas.getContext('2d'); draw.fillStyle = 'rgba(0,0,0,0.5)'; draw.fillRect('10', '1...

jQuery cross-browser issue

I have this code that works great in all browsers but not IE6, and I have no idea why, can anyone shed any light on this? $("#handle").toggle( function () { $('#login').animate({ marginTop: '0', }, 1000); $("#handle").addClass('opened'); return false; }, function () { ...

Javascript string search inconsistencies.

I have a two strings, word and text. text is generated by looking at the node values of text nodes in a table. word is a string to find in text. However, in this situation, In Google Chrome 5.0.375.125 (Official Build 53311) beta, and Firefox 3.6.8, I get the following output: console.log(text) st. text text text text text text te...

How do i calculate the height of toolbars, address bars and other navigation tools in pixels?

Hi, Basically i need to know how many pixels the y axis is from the top left of the screen until i reach the actual web window. Does anyone have any ideas...? ...

Mootools: How to create new element `span` inside `li` element on mouseove?

The HTML code: <ul id="el"> <li></li> <li></li> <li></li> <li></li> </ul> How to create new element span inside li element on mouseover? <ul id="el"> <li></li> <li></li> <li><span></span></li><!--on mouseover > new element span--> <li></li> </ul> ...