javascript

jQuery validation plugin - removing elements

I'm using the jQuery validation plugin. On most of my input type... tags I have class='required'. When I submit the page, via JavaScript, the controls on the page that have this class are found. However, there are a handful of checkboxes that I don't need to validate. I've tried removing the class code completely from the input tag, ...

changing img src with JQuery but leave pathing info intact?

I'm using JQuery to switch out an image src thusly: $("#myImg").attr("src", "../../new.gif"); notice the relative pathing on the new src. Unfortunately, this isn't portable when I deploy my app. In my MVC app I'm using a ResolveUrl() method that will fix the pathing problem for me so it's portable, but now my JQuery image src swapper ...

Determine if a point is inside a triangle formed by 3 points with given latitude/longitude

I have 3 points ( lat , lon ) that form a triangle.How can i find if a point is inside this triangle? ...

Passing ruby variables to javascript function in rails view

I'm wondering what the best practice is for passing variables to JavaScript functions in a rails view. Right now I'm doing something like: <% content_for :javascript do %> <script type="text/javascript"> Event.observe(window, 'load', function(){ js_function(<%= @ruby_array.to_json %>, <%= @ruby_var %>); )} </...

Accessing a CheckBoxList control in a DotNetNuke Module

Hey all, I'm hoping I can get some quick help on this as I've been stuck here for the last week and can't move on until I get this figured out! I have a dynamically created CheckBoxList in a DotNetNuke module I'm building. When DNN creates the page, it prepends the control name with the moduleID and moduleName. So, when I have "AddLice...

Sync my web page with the server, when a connection is available (AKA offline mode)

I'd like my web page to allow the user to add data, even when he's in offline mode and maybe store the data in local storage (cookies, html5 storage). When the user gets back online again, the page should detect the live connection and post the data to server. Is there a mainstream way to do this? Maybe a javascript library or plugin? ...

How to include a JavaScript function call as a parameter on another JavaScript function?

Hi, How can I have a parameter to one JS function be Function Name with parameters to call another function? something like: onClick="Clicked(this, 'SomeFunction('test')'" Regards ...

safari and chrome javascript console multiline

Firebug has a multiline feature in their console tool. Is there a way to get this functionality with the debugger tool in Safari/Chrome? ...

Using Javascript to submit a form

I'm using ExtJS on a registration page which should have no effect on this. <form name="registerform" id="registerform" method="POST" action="registerProcess.php"> I have that form and the javascript document.registerform.submit() will not submit the form.... any ideas? ...

How do you build an Oa_zones array in to utitlize OpenX full page invocation in Rails?

I'm serving ads using OpenX within Rails. To correctly use the OpenX full page invocation you need to set Oa_zones[] array, otherwise all available ads are requested (but will never be used). These are the necessary pieces: Build an array of zones. Ideally zones could be added in any partial, so working with this array needs to be a...

Google Maps API - How to get map type constant name (G_NORMAL_MAP, G_SATELLITE_MAP...)?

I would like to get current map type constant name (G_NORMAL_MAP, G_SATELLITE_MAP...) for later use. getCurrentMapType() returns GMapType class. Here I can call getName() method, but it returns only button label, that varies according to language. Is it possible to get constant name? I would like to store it and later use for setting m...

Ignoring old multiple asynchronous ajax requests

I've got a custom javascript autocomplete script that hits the server with multiple asynchronous ajax requests. (Everytime a key gets pressed.) I've noticed that sometimes an earlier ajax request will be returned after a later requests, which messes things up. The way I handle this now is I have a counter that increments for each ajax...

How to override HTML <FONT SIZE="2"> with CSS

I was given the task of doing a facelift to our current site. I am moderately well versed in CSS so I am converting the bazillion tags to CSS styles and deleting about 2 times that many that were simply not necessary. It's all going well until I run into a certain product page that is only a wrapper into which other HTML files are p...

How do you replace many characters in a regex?

I am sanitizing an input field and manually getting and setting the caret position in the process. With some abstraction, here's the basic idea: <input type="text" onkeyup"check(this)"> And javascript... function check(element) { var charPosition = getCaretPosition(element); $(element).val( sanitize( $(element).val() ) ); setCa...

In chrome with a greasemonkey extension, how can I modify an `<a...>` construct to strip out the onclick= attribute?

I want to modify an internal webpage to strip away some of the onclick behavior of certain links. The internal webpage has a bunch of links like: <a href="/slm/detail/ar/3116370" onclick="rallyPorthole.showDetail('/ar/view.sp','3116370','pj/b');return false;">foo de fa fa</a> How can I do an extension to Chrome so it does the follo...

How do I search using the Google Maps API?

Hello all, I'm trying to figure out how to search for nearby businesses in an iPhone app using the Google Maps API. I'm completely new to Javascript, and have waded through some of Google's sample code easily enough. I found how to grab the user's current location. Now I want to search for "restaurants" near that location. I'm just bu...

Javascript iframe caching issue

I hava an iframe which loads some javascript via javascript. In internet explorer only, this works if and only if IE has a cached copy of the javascript. This means that reloading the page (or otherwise triggering the script to run again, if it's stuck in a function or whatever) will cause this code to work, otherwise it will not. In ...

Wait until image loads before performing function

I'm trying to create a simple portfolio page. I have a list of thumbs and an image. When you click on a thumb, the image will change. When a thumbnail is clicked, I'd like to have the image fade out, wait until the image is loaded, then fade back in. The problem I have right now is that some of the images are pretty big, so it fades ou...

How can I run jslint as a javascript compile tool in emacs for Windows?

I'm using GNU Emacs on Win32. I want to be able to run jslint as a compilation on .js files, and then step through the errors that jslint reports. I have jslint, the WScript version. ...

How to get the root path in JavaScript?

I am using mod_rewrite to remap the URLs in my website in the following format: http://www.mydomain.com/health/54856 http://www.mydomain.com/economy/strategy/911025/ http://www.mydomain.com/tags/obama/new The problem is that I am making AJAX calls to a file: http://www.mydomain.com/login.php And I don't want to write the...