javascript

how to respond to a Javascript event only if it is fired once and then not fired again during some time period?

Hello, In my application I listen to the Google Maps API 'bounds_changed' event to send an ajax request to update some div on the webpage depending on the new boundaries of the map: google.maps.event.addListener(map, 'bounds_changed', function() { // here goes an ajax call } The event 'bounds_changed' is fired with a high frequency...

Month Array in JavaScript Not Pretty

How can i make it nicer? var month = new Array(); month['01']='Jan'; month['02']='Feb'; month['03']='Mar'; etc. Itd be nice to do it like: var months = new Array(['01','Jan'],['02','Feb'],['03','Mar']); For example. anyway like that to simplify it? ...

jQuery: load method reload same div in div?

hey guys, i'm a little confused. i want to actually reload the same page and fetch a div with a certain id from it. so i'm trying to reload a part of website into the same part of the website. ;) i know it sounds weird. somehow i don't get what i'm doing wrong or better how i have to do it. var $sv = $('#server_view'); $sv.load('/serv...

The use of a lightbox and the click events

I'm using a lightbox for image viewing and I just have to use rel="lightbox" inside <a>. The problem is that my site has AJAX for every link, so I coded $('a').live('click', function() { $('#content').load($(this).attr('href')); return false; }); This way, every link turns to be an AJAX request. What is pissing me off is that ...

jquery and/or javascript simplest issue (but can't figure it out)

Hi, Using jquery, The following line works i.e. radioClicks function gets called. $("input:[name='"+54464+"']").bind( "click", radioClicks ); but this one doesn't: $("input:[name='"+options.rowId+"']").bind( "click", radioClicks ); and yes, you have guessed it, options.rowId = 54464 (at least in the debugger) . What am I missi...

is greasemonkey a build-in extension of google's chrome

I'm trying both greasemonkey and google's chrome extensions. And found that chrome seems using the same names of api as GM. (Seem having the same bug...) Just wondering whether greasemonkey is already a google's chrome extension? ...

Add content to sibling div

In the example below what's the simplest addContent function that will put some content into the child div? <div> <a href="javascript:addContent();">My Link</a> <div/> </div> Clicking the link should result in: <div> <a href="javascript:addContent();">My Link</a> <div>Added Content</div> </div> ...

Javascript: get window.location everything but host?

hi guys, i have like http://www.mydomain.com/hello/you with top.location.host, i can get "http://www.mydomain.com" with window.location.href i can get "http://www.mydomain.com/hello/you" is there a chance to get just "/hello/you" ??? ...

Is there a REST based ORM?

I've been looking at JavaScriptMVC, and I'm pretty interested in the idea. I'm wondering, though, if there are any ORM solutions for such an architecture. It seems like you will end up having to write two data access layers, one server side to fetch items from the database and one on the client side to retrieve items via AJAX. My ques...

Good practice method for loading JavaScript via ajax

Disclaimer: I'm fairly new to AJAX! I've looked around, and I'm not sure which method to use to load javascript using ajax. I'm using ajax to request pages that each require their own 6-10 short methods. In total there will be maybe 5-6 of these pages, so an approximate total of 35+ methods. I would prefer to access necessary javascri...

Translating Python into JavaScript — Lists?

octopusList = {"first": ["red", "white"], "second": ["green", "blue", "red"], "third": ["green", "blue", "red"]} squidList = ["first", "second", "third"] for i in range(1): squid = random.choice(squidList) octopus = random.choice(octopusList[squid]) print squid + " " + octopus Can anyone help me write ...

Get pixel data at touch - Android/iPhone Appcelerator Titanium

Is it possible to get pixel level data of an image view using Titanium Mobile on Android/iPhone? ...

Another way to concatenate

Is there another a way to concatenate a '#' character like I'm doing below? radioButtonID = '#' + radioButtonID; ...

Getting undefined value from an array

Talk is cheap; I'd rather show the code: //global var var siblings = []; var rand = new Date().getTime(); siblings.push('uin_' + rand); alert(siblings['uin_' + rand]); // undefined Why undefined? What I basically want to achieve is to have a global object that would be a storage where info about other objects get saved. But get back ...

Subclassing Javascript Arrays. TypeError: Array.prototype.toString is not generic

Is it possible to subclass and inherit from javascript Arrays? I'd like to have my own custom Array object that has all the features of an Array, but contains additional properties. I'd use myobj instanceof CustomArray to perform specific operations if the instance is my CustomArray. After attempting to subclass and running into some ...

Fill Acrobat Form date field with today's date only if field is empty

The goal is for an Acrobat form to fill a date field ("MeetingDate") with Today's date when the user opens it. If the user saves the form as is and opens it a few days later, the old date should still be there, not replaced by the current date. If the user changes date in the field, that date should be saved and should not be replaced wh...

simile timeline search

I want to filter the content in a simile Timeline display on some field other than description.Is it possible? ...

Good way to load multiple lat/long points from a database into google map markers?

I have a table containing multiple addresses, including their Lat/Long coordinates, and I want to place many of these markers onto a google map at once, using asp.net webforms and Google Maps Javascript API V3. The tutorials show how to add one marker: http://code.google.com/apis/maps/documentation/javascript/overlays.html#Markers var...

How to identify browser tab closing using javascript or jquery?

How to identify browser tab closing using javascript or jquery? I have to give a confirmation message when user click on the browser close button. If user press yes button I have to load another page on the same tab. if press cancel. then close the tab. any body knows the scripts for this functionality. Please help me :( ...

javascript for loop, jquery id generation and recognition

Hello friends, var product=""; for (var i=0; i<10; i++) { product+="<div align='center' width='88' id='"+i+"'>"+i+"</div>"; $("#"+i).hover(function() { alert(i); }); } product variable is able to generate the desired output with the div ids ,but when I m moving my mouseover those divs, that mouseover function(f...