javascript

previous / next within a range of numbers

hey all.. i need a function that would return a previous and next numbers, but only within my numbers range. so, for example, if my range is from 0 to 7, and im on 6 - next should return 7. if im on 7 - next should return 0 (it circled back to it). same for previous, if im on 0, previous should be 7. I think modulo can be used to figur...

Is there a fast way to delete a specific value from an array in Javascript?

I have an array var array = ["google","chrome","os","windows","os"]; I want to delete the value "chrome" from the array without the array becoming a string. Is there a way to do this? ...

jQuery delay vs. setTimeout for jackpot "spinner" image swapping

Scenario: I want to create a jQuery controllable jackpot "spinner" that will rapidly sequence a number of random images through a div before settling on one, with the delay interval between each equal but changeable. For mockup purposes, I'm simply changing CSS color classes to a box, although in the final I'll use background images. ...

Checking specific checkboxes based on select option using Jquery

I am trying to check checkboxes based on a select option. So, if the user chooses one option 3 from the dropdown, I want it to automatically check checkboxes with the ids set as 4, 24, and 17. I have predefined the variables using PHP, so that my array is as follows: var per =[]; per['3'] = []; per['3']['4'] = '4'; per['3']['24']...

Calling a function inside a function javascript

I have this code inside the success function of a jQuery ajax call success: function(d) for (var n in d.items) { google.maps.event.addListener(markers[d.items[n].id], 'mouseover', function() { focusMarker(d.items[n].id); }); } Unfortunately, the function always evaluated d.items[n].id as the last item in d.item...

Is it possible to recolor an image using JavaScript?

Hi everyone, I was wondering if anyone knew of a way to recolor an image using JavaScript. Any type of access to an image's pixels would work, I suppose, as long I could read/write color values. It should work in Firefox; if it doesn't work in IE, no big deal, but it would be a benefit if it did. Thank you for your help! ...

Event is Undefined in IE works in Firefox

I have onKeypress Event in Text Box This Works in FireFox, does not in IE event is passed as undefined in IE PriceInBox.onkeypress = function(event) { return moZoltarCurrent.evt_checkForInt(event); } ...

Agnostic Javascript Framework Adapter for jQuery and Mootools?

Hey all, I'm about to port a series of my jQuery projects over to Vanilla Javascript (pure javascript, no framework) and would like to know if there are any existing [framework adapters / framework agnostic adapters] out there? For instance I'm envisioning something like this: // My Project (function(){ // Fetch all the elements u...

JavaScript pivot table

Are there any open source pivot tables with drag&drop support or what is the fastest method to implement it? Which JS library to use? I wanted JQuery, will this be the right solution? ...

How to override BOLD on the toolbar in ckEditor

When ever i click on B in ckEditor, i want to pop a msgbox like alert('Good Morning') . How to do this? ...

Calculate bounds from center and zoom (Google Maps API v3)

I need to calculate the bounds of a map given center and zoom level. I imagine I could temporarily set map center and zoom and call map.getBounds(), but I would prefer not to (I would need to disable/re-enable a few event handlers). Does anybody know how to do this in v3? ...

How to base64 encode inside of javascript

I am trying to implement a simple script on a site that will return base64 encoded information from google's ajax API. This is what I am playing with so far: <html> <head> <script src="http://www.google.com/jsapi?key=ABQIAAAA0duujonFsEX871htGWZBHRS76H0qhS7Lb-D1Gd0Mnaiuid8Z7BQIyz2kMpojKizoyiCQA4yRkKAKug" type="text/javascript"></script>...

Event lost in ajax callback

I'm have a Rails 3 app that uses Prototype. I create a form with: =form_for :appt, :url => { :controller => "appts", :action => 'create' }, :html => { :id => "apptform" }, :remote => true do |f| That controller returns some json: render :json => @appt Some javascript waits til the dom is loaded, then sets some observers: document...

Passing Value Including Spaces on Ajax Call

Trying to pass spaces along with ajax call. 'word' is been passed the same as 'word ' i believe so. On the other hand two words need to be send completely with call. 'word second' but not the same as 'word second ' Should I trim before call or do this on server side script? How can I send spaces as well? ...

Javascript and JQuery "this" scope errors

A sample bit of code: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"&gt;&lt;/script&gt; <div id="myinfo">info</div> <input id="clickme" type="button" value="click here to display info"/> <script type="text/javascript"> function Fighter() { this.name = "Kenny"; // fight...

Javascript/jQuery - How do I obtain name of the class of clicked element?

I googled and googled and I concluded that it's very hard to get answer on my own. I am trying to use jquery or JavaScript to get a property of clicked element. I can use "this.hash" for example - it returns hash value I presume. Now I would like to get name of the class of clicked element. Is it even possible? How? And where would I...

IE:how to get popup's opening window when using window.open(url)

we are running a click-to-call service, my idea is basically like this: website have a link on their page, when the link is clicked, a web page(say it is popup.aspx) hosted on our server is popup, user can input their phone number, and click "call me" button to let the website call him. In the button click event, I want to get Request.Ur...

How to not open a new window (JavaScript popup) if jQuery validation plugin returns false? (ASP.NET)

Hi, I have an .aspx page with a couple of textfields. I validate these with jQuery validation plugin when the user clicks the submit button. When the submit button is clicked I also open up a new window, but I only want to open the window if the fields are correctly filled out. How do I stop the window from opening if the fields are no...

problem with parent() (jQuery)

problem with parent() jQuery Code http://webdev.faressoft.org/wp-content/plugins/ImageSlideShow/js/slideShow.js You can see the result here (Image Slide Show) http://webdev.faressoft.org/?p=208 $(".ImageNum span").click(function() { var image = parseInt($(this).text()); $(".correntImage", $(this).parent()).removeClass("correntImage")...

Javascript need two date instances Keep getting references instead

How to have a date and subtract 1 year and have a second date for use in display and caculations? I'm a newbe with JS and find myself fighting the date object I have declared both currentDate and purchaseDate As var new date() in the globals area But now in a function I try to assign the Original date as "currentDate and the purchaseD...