javascript

JS: Create copy of object

Possible Duplicate: Copying an Object in Javascript How can I create a new object from other object? Something like copy constructor in other languages like C#. ...

Populating div with checkboxes

I use this code to determine checkbox width and height: var chk = $('input[type="checkbox"]:first'); chkWidth = chk.innerWidth() + parseInt(chk.css('margin-left').replace('px', '')) + parseInt(chk.css('margin-right').replace('px', '')); /*IS there better way instead of px replace?? */ chkHeight = chk.innerHeight() + parseIn...

PHP javascript problem

i am beginner of shopping cart application. i am installed os commerce downloaded code in my local computer. It is up some extent working, but before checking page i stuck on same page. i am trying to pass variable information to javascript function, it is working. And i required to set java script variable set to session. how can ? i...

JQuery animation: Is it possible to change speed during the animation?

I want to move a div down a page, and I want it to slow down as it reaches the target. I tried using call back with recursive func but it doesn’t look smooth: function MovePanel() { sidePanel.animate({"marginTop": newCurrTop}, moveSpeed,function(){MovePanel();}); Is it possible to slow down an JQuery animatio...

jQuery table colorize plug in issue

I was wondering if anyone could help me figure out where i may be going wrong. I am using the Table colorize plugin to highlight some table columns depending on which column has been clicked. The table can be swapped in and out with different data via AJAX on clicking some tab links in an unordered list. Basically the plugin works gre...

Get Latitude and Longitude under cursor in GoogleMaps without map.onMouseMove

I have GoogleMaps-object. Also I have SouthWest and NorthEast point in GLatLng-format. Also I have (x,y) of cursor over my object. I want know GLatLng under cursor without use map.onMouseMove (only use DOM-onMouveMove). I try write JavaScript-code: var w = map.getSize().width; var h = map.getSize().height; var le...

How to have a control dynamically appear (after choosing a dropdown option)

So say I have a dropdown control, and after the user uses the drop down, I want a checkbox and label to appear, AJAX style, without a full postback. How can I implement something like this? Examples of code (or links to them) would be great. I played around with this some using updatepanels but I can't get it working right... ...

What does x.length do in JavaScript?

I am doing this JavaScript math question where it asks me his math question. I do the math, type the answer in the box, and sumbit it. If i am right I move on but I got lost at x.length. I don't know what that means. Here is a example of the problem: var a= 5+6*4 var b= a / 9 Function (x) ( if (x.length == b) ...

JqTouch - Detect trigger for animation

Yet another problem I'm having w/ jqTouch... I'm trying to detect what element was clicked to trigger an animation so that I can pass parameters from the clicked item to the subsequent page. My HTML is: <div id="places"> <div class="toolbar"> <h1>Places</h1> <a class="back" href="#">Back</a> </div> <ul> <li id="1"><a ...

Class as an Event Observer

I want to do something like this... var Color = Class.create({ initialize: function() { this._color = "white"; this.observe("evt: colorChanged", this.colorChanged.bind(this)); }, changeColor: function(color) { this._color = color; this.fire("evt: colorChanged"); }, colorChanged: functi...

Testing for Javascript is enabled in ASP.NET MVC

I've been looking for a way to test to see if the user has Javascript enabled or a browser that supports it in ASP.NET MVC, and if they don't then route them to a page that tells them the site requires it to work. However I haven't been able to find a definative answer to this..any suggestions? ...

Metatag replacement in client side

I have requirement where i need replace the Meta Tags on client side based on some user selection. For that what i have tried is i have meta content with in the DIV Tag. On Java script i am planning to replace. Div and innerhtml My Meta taga are placed with the Head tag. Using the DIV tag i am not able to put the meta tags dynimically. I...

Read-only Combobox with ZK Framework

Why the Combobox components, when read only, don't allows the user select a option with the Page Down\Page Up keys? How to enable this feature? ...

changing input text to textarea just like in facebook

i would like to replicate that you see a regular input text and when you click it changes into textarea. is this a hidden layer or is it actually changing the input to textarea? how to do it? ...

How to copy a variable in JavaScript?

I have this JavaScript code: for (var idx in data) { var row = $("<tr></tr>"); row.click(function() { alert(idx); }); table.append(row); } So I'm looking through an array, dynamically creating rows (the part where I create the cells is omitted as it's not important). Important is that I create a new function which encloses...

When and how does Asynchronous Google Analytics execute?

I'm switching over our site to use Asynchronous Google Analytics, and I'm curious about it's method of pushing events to the _gaq array. Near as I can tell, events are placed into a waiting pattern in _gaq while the ga.js script is being asynchronously downloaded. Do they fire once the script is downloaded, and how are post-document load...

How to use javascript to swap images with option change?

Hi everyone I need to make javascript code to swap images with option change. Here is the code: <select name="Color:"onchange="document.getElementById('myimage').src = this.value; "> <option value="images/taylormade_purelite_standbag_bk.jpg">Black/White</option> <option value="images/taylormade_purelite_standbag_by.jpg">Black/Yellow</o...

javascript is not working with asp.net content page

I have java script code to set some of the properties of ajax controls. the code is working OK If I put it in asp.net page but when I use content page and post the code in part of the code will not work which is changing the value of ajax control properties. My page has textbox, checkbox, MaskedEditExtender and MaskedEditValidator. whe...

jQuery response is empty in browser, though curl works.

I'm using jQuery's .ajax() to call a server (actually local Django runserver) and get a response. On the server console, I can see that the JSON request comes in, he proper JSON response is made, and everything looks OK. But in my browser (tested on Firefox 3.6 and Safari 4.0.4, and I'm using jQuery 1.4.2), it seems the response body i...

Manipulating the DOM tree

Hi, If I load a page in an iframe, run doc.querySelect to retrieve a node N, append N to doc.body by doc.body.appendChild(N), and then remove all children from doc.body until it reaches N, would N be guaranteed to be rendered the same way as pristine in Firefox or IE? So far in the example that I have tried, it's alright, but I was wond...