javascript

In JS/JQuery can I pull a single element out of a Multi-Dimensional array and store it in another array?

I am using flot to do some graphing and I am trying to animate the graph into steps. I want to take a multi-dimensional array with say 3 objects where each of those objects has 3 objects. So I have this: array1[0][0] = 30 array1[0][1] = 30 array1[0][2] = 10 array1[1][0] = 35 array1[1][1] = 35 array1[1][2] = 15 array1[2][0] = 40 array1[2...

css background image displays when user clicks link problem

I updated my post. Now it says "link is not defined" "thisLink[link].scopeObject = new Image();" It's important that the link remains though because it is a property of linkObj that holds the current link. I use the [] as a property rather than dot notation due to the looping ability it provides. <script type="text/javascript"> window....

JQUERY: When I remove a attr, I can't add the attr again

This is my code: $("input[name=donationmode]").change(function() { $(".setpaymentOptions").children().addClass("fadeout"); $(".setpaymentOptions").children().children(".inputfield").children("input").attr("disabled", "disabled"); $(".option-"+$(this).val()).removeClass("fadeout"); $(".option-"+$(this).val()).children("....

javascript string manipulation

I would like to modify my strings so i can replace the character ' ' with '_' using JS,for example "new zeland"=>"new_zeland" how can i do that? ...

is using the $() shortcut in jQuery bad practice?

I was recently listening to a podcast which made a comment on using $() vs using jQuery(). It was stated that every time $() was used a new object would be created and when jQuery() was used this was not the case. I google'd around but couldn't find anything on this specific topic. I realize this is not a typical example, but the follow...

How can I define variables in a for loop in javascript?

I'm trying to define variables within a loop. I'll drop the code here and then try and explain some more: for (var k=0; k<nodes.length; k++){ this[node+k] = new google.maps.Marker({ position: new google.maps.LatLng(array1[k], array2[k]), map: map, title: node[k], icon: "some image file" }); } I ...

which is the best javascript library for making canvas compatible with IE

I have an application with heavy use of canvas (dinamyc created, circles, squares, a brush pen, some kind of online microsoft paint). I am searching for the best compatible canvas js library for supporting IE7+. Any suggestions? i tried excanvas.js but I didn't get the same results as i use to see in firefox. ...

Dynamic web page...filling in data on the page when a link is clicked

I want to implement a web page (using HTML/PHP, whatever else), that will populate data int the top half of the page (seem image below). The top half will contain links. When the user clicks on the links, I want to populate the bottom half of the page with detailed information about the item clicked on in the link in the upper half of ...

How to prevent mouse scrolling outside hovered element ?

I have a div which is set to overflow:scroll;. I get scrollbars which is what I want. However when scrolling the div with the mousewheel it scrolls the rest of the page when it reaches the top or bottom of the div's content. How can I scroll only the div or the entire page based on what's hovered ? ...

Javascript menu behaving poorly in IE

Let's get down to it... site: www.erisdesigns.net html: <div id="wrapper"> <div id="header"> <div id="nav"> <dl class="dropdown"> <dt id="one-ddheader" onmouseover="ddMenu('one',1)" onmouseout="ddMenu('one',-1)"><a class="menu" href="index.htm">Home</a></dt> <dd id="one-ddcontent" onmouseover="cancelHide('one')" ...

On Error Resume Next in Javascript?

Does try ... catch(e) provide the same service as On Error Resume Next in VB? I have a page which uses several JQuery plugins as well as some functions I have written myself. It would take a lot of work to address all possible exceptions. For now, I want to tell the script not to break on would be fatal errors. How do I do that when...

How to call Onload function in the Main page as well as @include file inner.jsp page

Hi, I have two pages one is the main page and the another one is the inner page: Page names: main.jsp , sidebar.jsp I want to call the onload function on both of these pages. Is that possible. If yes How? Below is the code for main.jsp: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DT...

youtube javascript api doesn't trigger callback

Hello all, I'm trying to work with youtube's javascript api and am having a problem initializing it/getting a callback when it's ready. Api documentation can be found here. I'm getting the videos from the json provided by youtube and embedding them like this: //insert flash object in video element $(video_elm_arr[i]).ap...

Changing CSS class with Javascript

Is there a better way than the implementation I have now? I'm concerned that the way I've done it is a little hackish and am wondering if there's a more elegant solution. I want to change the "selected" element on the page by applying a CSS class to it, and remove the one that is currently selected. The code I have for changing the elem...

Can I use a JSON array as a small database?

I'm retreiving a JSON string and parsing it with jQuery with $.getJSON. After I get the data in a variable, can I add or remove rows? An example: {"one": [{"sid":"1","name":"NAME 1"},{"sid":"2","name":"NAME 2"}], "two": [{"sid":"3","name":"NAME 3"}]} Can I delete sid 1 from "one" and place it in "two"? How about sorting by sid? I'm ...

Please Kneecap My Bug-- XML Parser Error using Flex 3, OpenX in IE

Hi, I'm trying to get Flex 3 and OpenX to work together. Everything works great in Safari and Firefox. But, I get an XML parser error in Internet Explorer, which makes me want to rip my hair out and drink turpentine. I've tried to simplify the problem as best I can. Basically, I take the adReturn and then turn it into xml. adReturn ...

To know file size beforehand in JS

Is it possible to get the file size of the file being submitted before the upload actually starts on Javascript? ...

Disable Dojo validation on certain fields

I would like to disable client side validation on certain fields in my user form. Currently I have two sets of fields that are displayed depending on the value of a previous drop down list. i.e. if the drop down list is set to value "A" 1 new field appears in the form. If the drop down list is set to value "B" 3 new fields appear in t...

$(document).ready(function() {...}) runs before plugin script loads

I'm getting a JS error because my $(function () {...}) handler is being fired seemingly before the prerequisite plugin script is loaded. Only happens in IE (testing in IE7). I have some HTML in my <head> that looks like this: <script type="text/javascript" src="../resources/org.wicketstuff.jwicket.JQuery/jquery-1.4.2-special.js"></scri...

Unable to execute functions on elements loaded with AJAX (jQuery)

i am using .prepend() to load data after i POST a form with .ajax(). once the new elements are added, my functions won't work on them. if i link the js file directly in the prepended data, the functions work, but when i POST, i starts multiplying the events. i have a feeling it has something to do with binding, but i am not able to f...