javascript

Single quotes in JavaScript object literal

I'm looking at the Google Maps API tutorial, and I see this: <script type="text/javascript" src="http://www.google.com/jsapi?autoload={'modules':[{name:'maps', version:3, other_params:'sensor=false'}]}"></script> Why is modules wrapped in single quotes? ...

Store checkbox values in cookie

Hi, I need to store checbox values in a cookie to use in a comparison page. Please help. Thanks, C ...

I have a bunch of images being shown on click via JQuery - any easy way to animate this?

This is the (quite simple) JS code I'm using: $(document).ready(function() { $(".button-list .next").click(function() { project = $(this).parents().filter(".projektweb").eq(0); currentimg = project.find(".images-list li.current"); nextimg = currentimg.next(); firstimg = project...

return a php associative array to javascript array

I am trying to return a php associative array to javascript array through ajaxRequest.responseText Here's what I do. First in php, I do this: $encoded = json_encode($thisarray); echo $encoded; If I echo $encoded, I get {"a":"apple,arrow","b":"boy,bank","c":"cat,camp"} Then in js script, thisarray = new Array(); thisarray = ajax...

Javascript Grid that can handle sections in a table

I am making an ASP.NET MVC application that lets a user design a questionnaire that other users can fill out. Now, questionnaires, rather than just having a list of questions, often have sections or subsections that could have headings and not the other columns that an ordinary row (a question) would have. I want a JS Grid that can han...

basic javascript question on geolocation and googlemaps

hello all, Im hoping that somebody can help me out on what i feel is an easy answer but I just cant get it to work out. Im trying to trap the geolocation lat and long and place it into the google maps api so far i have var myOptions = { zoom:7, trips:1, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new goo...

jQuery: plugin inter-communication

Here is the problem: I have a very complex plugin that does lots of different initialization and binding when it is executed. I want to be able to run the same plugin multiple times on the same element, giving it different options. After it runs once on the element, certain initialization does not need to be done again on subsequent ex...

Javascript - document.links.className ?

I have a Javascript question that I am curious about. When using: var test = document.links(arrayNum).name; Is it possible to dig deeper into specifying links? For instance, if there is just a group of links from within a div with an id that you would like to target as opposed to all the links on the page could you write something l...

Detecting browser capabilities and selective events for mouse and touch

I started using touch events for a while now, but I just stumbled upon quite a problem. Until now, I checked if touch capabilities are supported, and applied selective events based on that. Like this: if(document.ontouchmove === undefined){ //apply mouse events }else{ //apply touch events } However, my scripts stopped working ...

Javascript Cookie Function not working for Domain

Here are the functions Im using: Set Cookie: function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure ) { var cookie_string = name + "=" + escape ( value ); if ( exp_y ) { var expires = new Date ( exp_y, exp_m, exp_d ); cookie_string += "; expires=" + expires.toGMTString(); } if ( path ) ...

How to design app to be modular / support plugins

I'm currently in the process of refactoring my webplayer so that we'll be more easily able to run it on our other internet radio stations. Much of the setup between these players will be very similar, however, some will need to have different UI plugins / other plugins. Currently in the webplayer I do something like this in it's init():...

innerHTML and event delegation

Hello, I have a containing div that has multiple divs within which is updated every 25ms using innerHTML (for performance reasons). I have tried using event delegation to capture events but nothing I seem to do captures the click event. I think this may be due to the speed that the contents are getting updated. Any ideas would be very w...

xml data lost in JSON conversion

I am getting the following result from converting xml to JSON, using more than one conversion library. As you can see, the property name attributes are lost, as are the Item name attributes. Why? Does anyone have recommendations on how I might change my XML to make it more conversion friendly? <Asset name="xyz"> <Property name="p1">V...

Javascript: regular expression

I need to replace a substring from some string. I've already created corrected code for doing it. But I amn't sure is it best way. Please, see code below: var str = 'test ruby,ruby on rails,ruby,' var substr = 'ruby'; var reg = new RegExp(',' + substr + ',|^' + substr + ',', 'gi'); str.replace(reg, ','); //returns "test ruby,ruby on rai...

Javascript - Get callback info back to original calling function.

Let's say you have a Javascript function that calls a web service method. So that webservice completes and calls a callback function, which has the result. How do I get that result back into the original function that called the web service method? Essentially, I'm trying to "synchronize" an asynchronous call. Update: This is what I...

Firefox Extension Port Listener

Hey, I'm trying to get an extension to wait for a xml message from another program over an internal port. Just something like waiting for a single UTF-8 string that has something like: <?xml version="1.0"?> <status received="true" state="started"></status> and <?xml version="1.0"?> <status received="true" conn="closed"></status> I...

Insert elements at <script> tag position

Hi folks, When sites give you some JavaScript that you paste into a web page to have content inserted at that position, how does the script determine its current position in the DOM? Without using document.write? Thanks, Nick ...

Javascript - Regx to check for characters

All, I am looking for a JavaScript function that checks for the following characters (without commas) in a string. If they are present, it would return false, else returns true <,>,(,),#,"",',:,:: Thanks ...

Virtual Earth adding pushpins by address - events firing out of order

I’ve been working on a mapping project to display service orders for a utility company but I’m having some issues getting the numbering on my pins and the info boxes. The following is a small segment of the page I’m working with to demonstrate the issue. http://www.evocommand.com/junk_delete_me/virtual_earth_testing/VirtualEarthTest.htm...

JQuery error in IE, works with FF. Maybe a problem with live.

Hello. I have an ASP.net MVC2 application. In wich I'm using JQuery to alter all table rows so I can click anywhere in any row to trigger a click event on a link in the clicked row. The tables is created using MVC's built in partialview ajax. Here is my JQuery script. <script type="text/javascript"> $(document).ready(functi...