javascript

Does javascript work on mobile phones?

Does javascript work on mobile phones? ...

Accessing CGI values with Prototype

Anyone know the quickest way to grab the value of a CGI variable in the current URL using Prototype? So if I get redirected to a page with the following URL: http://mysite.com/content?x=foobar I am interested in retrieving the value of "x" (should be "foobar") in a function called on page load like this: Event.observe(window, "load"...

How do I get the value of a textfield without posting the form

Is there anyway I can get the value of a text field without posting a form. I would like to use the value somewhere else in the same page. ...

Div popup of a movie or image

I am looking for a Javascript that will pop up a modal floating div which can hold an image and will ghost our the full background of a web page. Sort of like the way the movie pops up here in this Apple trailer. ...

Excel sheet manipulation

Here is what i have to do a webpage gives a excel sheet with if we set some conditions and hit get button,then i have to filter for some data on the excel sheet and put it on another excel sheet,like wise have to get data from different excelsheet and put it in a single file.How to do that. using javascript on page will be better. ...

Why do I get asked twice to use GPS in my iPhone web application

I wrote a very small web application that sends your GPS coordinates to a script. If I load the site in Safari on the iPhone, it asks if it can use the GPS coordinates, and if I click yes, it sends the data. If I add a bookmark to the home screen so that it can run more like an application, when the code reaches navigator.geolocation.g...

Running a script based on a dynamically generated DOM element

I'm working with a third-party product. It uses JavaScript (non-JQuery) code on the page to generate DOM elements on the fly. Is it possible to run a jQuery script whenever this third-party code generates a DOM element matching a given selector? To explain in another way, I don't want to try and integrate with that code. I just want to...

How can I invert a regular expression in JavaScript?

I have a string A and want to test if another string B is not part of it. This is a very simple regex whose result can be inverted afterwards. I could do: /foobar/.test('[email protected]') and invert it afterwards, like this: !(/foobar/).test('[email protected]') The problem I have is, that I need to do it within the regular expression ...

How do you generate forms with AJAX?

Okay, How do you generate your ajax-forms? Do you keep the <form>-code in the javascript-files and load the data with ajax (e.g. json), or do you load a generated html-file (with all the <form> and <input> that you just push to the browser)? Or is there another simpler way? If you use any framework, do you get your forms generated aut...

Javascript formatting date strangely

My locale settings are : Short Date Format : dd/mm/yyyy , Long Date Format dd MMMM yyyy so why does var d = new Date("8/10/2009") alert(d.toLocaleDateString()); throw up 10 August 2009 or var d = new Date("15/10/2009"); throw up 10th March 2010 ...

Javascript error: * is not a function

I'm using javascript to call functions that have been put into an object like so: generatewidgets['mywidget'] = function (mystring) { code } Later on, i loop through this object and call each function with a string parameter. argument = 'abcdefg'; for (this.key in generatewidgets) generatewidgets[this.key](argument); This works...

Should I format my ASMX web service responses for AJAX server side or client side?

Two parts to my question: I need to format my web service responses for display on my web page. Should I use JavaScript to format the responses or given that it’s a .NET web service format the response as HTML and then simply push it down to the client? If I'm using JavaScript to manipulate the response, what datatypes should I avoid ...

How would I go about detecting onclick events external to a particular iframe?

I have a page that has a bunch of different iframes (A, B, C, D) - all of which are fully visible at all times. Together, they make up the various portions of my application's UI. One of these iframes, iframe D - houses another, smaller iframe (iframe X) that is sometimes made visible by a user action. It should automatically disappear w...

JQuery hover only applies to the last element?

I have a little trouble understanding scope and lifetime using javaScript and jQuery. I have a function that takes an array of custom objects (gps is an array of groups) var currentGroup; for(var index = 0, length = gps.length; index < length; ++index) { currentGroup = gps[index]; var newGroup = $('<li id="groupno-' + currentGro...

how to set a cookie in the address bar?

I want to add a cookie so that I can exclude my interaction with my website from google analytics (I don't have access to put files on server as is third party application) Is it possible to set a cookie with javascript by executing code in teh address bar of the browser? ...

Default button asp.net / javascript problem

Every attempt I had at making a button default failed, until someone on here posted some javascript that checks the textbox for the enter key and hits the button. I tried putting my controls into a form and setting the default button, and some other stuff, but nothign worked except that javascript. The problem I have now is that I am u...

jQuery iterative Timer

I want to create a jQuery iterative timer. For this I wrote the following script: $(document).ready(function(){ var t; function x() { alert('x') t = setTimeout("x()",1000); } x(); }); First time the function x() called successfully. But from the next function x() is detect as undefined. What could I...

Getting the value of a SELECT box in Internet Explorer

I have a select box: <select id="item1" name="Item 1"> <option></option> <option>Camera</option> <option>Microphone</option> <option>Tripod</option> </select> And I have this JavaScript: var item1= document.getElementById("item1").value; item1 always shows empty, never the option sele...

Problem Setting Center on Google Map

Hi all, In google maps when i set a center through map.setCenter(new GLatLng(28.6589, 77.2104), 13); it not only sets the centre of the map but adds a marker on that place which i dont want it to be can anyone help me out? with thanks Ankur Ok guys I feel no harm to share my code at least it may help others also Here's the entire s...

Can I get two successive dialogs in javascript?

I have a need to check two unrelated conditions when the user clicks submit, and request user feedback for each. I can get one jquery dialog up working great but I will sometimes need two in a row, and then have it complete the button event. Here's the gist: I have button <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnCli...