javascript

How should I build a privacy drop-down (select) menu?

I'm trying to build something similar to Facebook's privacy selection menu, except without the 'custom' option. It will only list a few options such as 'show to all', 'show to friends only', or 'completely hidden'. Right now I'm thinking of using simple JavaScript to change a hidden input field to the new value they click on, so if they ...

Is there a way to get a mobile Safari WebApp to "forget" its state?

I have a nascent bridge scoring app that is meant to be stored locally on an iPod touch/iPhone (iPad? Would probably be fugly...) So far so good, got a custom icon rolling and basic JS navigation laid out, but my problem is that it retains its state when I quit the app. Is there a simple magic Apple meta tag for this? Or is it achieved ...

Interactive US Map

Is there any jQuery (or standalone) plugin that would allow be to build an Interactive US map just like this: http://bit.ly/9PSiDB Many thanks ...

jQuery .queue() not working as expected

The page in question is right here: http://s289116086.onlinehome.us/lawjournaltv/index.php I'm 90% of the way there, I'm just assuming there's an error with my syntax. Focus on the blue callout area with "Workers' Compensation" as the title: Basically, I've created a little slideshow there with the controls at the top and when you cli...

Are there any Rails Plugins that use JS to poll the server for completion of a background process?

I know it might be simple to write some polling JS that asks the Rails application if it has completed a background job. But I wonder if anyone has already packaged up this functionality as a plugin. Basically, I have a few delayed_jobs running, and am looking for a plugin that will poll the server for completion of a particular job, th...

How to apply CSS to HTML body element?

I am trying to get rid of this: document.body.className = "someclass"; I want to do this in CSS. body.someclass { . . . } unfortunately I am not able to get this working in Firefox, chrome. Am I doing anything wrong here? Is there any way we could apply a CSS class to body? ...

Can you capture an image from the webcam on an iphone in Javascript?

Basically just looking to see if you can capture an image from the webcam in javascript? I know you can capture the GPS position in an iphone in javascript so I'd figure there might also be extensions to do images as well. ideally doing this in a cross platform way would be great. Basically it would mean we could develop a web app i...

Using javascript on an HTML table?

Hi, few questions, just wondering if anyone can help? I have a table with 1 long row (1000 pixels) and one single column, how do i go about creating a method whereby when the mouse cursor is on the leftmost side of the cell, a variable, lets say X is set to 0, the further right the mouse cursor moves in the cell, the value of X increase...

Does UIWebView support javascript-based double-click events?

As usual, I'm trying to do something the easiest way possible, in this case implement a double-tap handler on a UIWebView like so: <div id="foo" ondblclick="clickHandler(this);" ... > It works fine in Safari and Firefox, and I know the code containing clickHandler is loading on the iPhone thanks to a now-annoying alert stmt at the end...

How do I get the "Install Missing Plugin" yellow bar to appear in firefox when flash is not installed?

My rails website uses the open_flash_graph plugin to generate flash graphs for my clients. If a customer doesn't have flash installed, it doesn't display any messages, it simply doesn't show any graphs. I've noticed that if I go to other websites that need flash, I get a yellow bar at the top of my firefox window that offers to "Instal...

how to save a captured screenshot locally in chrome plugin?

how to save a captured screenshot locally in chrome plugin? I m stuck badly. If it can be done by only npapi than please give me some examples. Please do help me. Thanx in advance. ...

highlight the text of the DOM range element,

I select some text on the html page(opened in firefox) using mouse,and using javascript functions, i create/get the rangeobject corresponding to the selected text. userSelection =window.getSelection(); var rangeObject = getRangeObject(userSelection); Now i want to highlight all the text which comes under the rangeobject.I am doing...

Rails Google Maps integration Javascript problem

update I Based on feedback, I've changed var maps to var adds. problem description I'm working on Rails 3.0.0.beta2, following Advanced Rails Recipes "Recipe #32, Mark locations on a Google Map" and I hit a road block: I do not see a google map. My @adds view uses @adds.to_json to connect the google maps api with my model. My databas...

How to disable Events for a while in Javascript or jQuery

Hello, I am wondering if you guys know different approach to disable an event for a while. Let me elaborate this more : Lets say I have a div or button which has a subscriber to its onclick event. To prevent the double click when the the methods are doing some ajax things, these are the some of the ways we can do : Disable the button...

User-friendly xml sensitization library that html encodes invalid parts of user submissions?

I would like to allow my users to submit a subset of xhtml that will be displayed to other users (likely I'll build a schema for it) but I want the server to handle validation more gracefully then hard rejecting invalid submissions. Instead I'd like the server to Html Encode invalid/harmful parts of the submissions (sanitize javascript a...

Javascript Close Browser or goto external site function

Hello, I've been trying to figure out how I can go about creating a javascript function that will only be called when a user is accessing an external site or closing the window to the current site they're on. So far I've come up with this, any help is greatly appreciated. <script type="text/javascript"> window.onbeforeunload = confirmE...

How to place a div center of the window after scrolling

I am having a div, which should be centre of the window, even after scrolling. How to achieve it http://www.flickr.com/photos/41695354@N08/4496376638/ ...

javascript setinterval function problem

i am using this code <a onclick="javascript:var t=setInterval("GetUpdates(5,ajaxResult)",300);">GetUpdates</a> but getting the syntax error ...

How to call a url and get response from it in javascript

I want to call a url with passing some parameter and i want to process the response coming from that url in javascript. ...

Change save to file name but from the client

This question asks about file name the servers sends and the fix was quite simply a content-disposition header in the http response. What I interested in is does anyone know of any way to do this from the client side if the file name is already known? Is there any special javascript to do this for example? A site I have to use but not ...