javascript

Iphone-web, jQuery: How can i make slider on web page to slide as the user slides finger on slider?

Anybody do something like that? ...

How to prevent watermark text being sent when a button is clicked?

I've implemented this textbox watermark functionality on some of the text boxes in my solution: http://cysemic.com/2010/03/jquery-textbox-watermark-revisited-making-it-a-plugin/ It's very useful, but it's causing me some problems. Specifically, when I click the submit button when the watermark is present on a text box, the watermark te...

make my browser blink as indicator

My coworker wrote a quick mvc chat application so we can chat about work stuff without leaving our desks. What are some ways to indicate to each other a new message has been posted? My first thought was make the browser title bar flash. Anyone know how? ...

How to check input is only a number, letter and space?

I need to write some Javascript to check an input to only allow number and letter and '-' and '_' and space bar. Here is my regular expression var pattern = /^([a-zA-Z])([a-zA-Z0-9_-]){1,80}$/; Above regex does not include space bar. How can I add space bar condition into my regex. ...

javascript: How do I verify timer properties?

If I have the following code: var myfunc = function() { alert('wow'); }; var t=setTimeout(myfunc, 300); Is there anything I can do with the id stored in t to verify the timer's duration and callback? I'm trying to verify the timer's properties directly so I don't have to actually run it 'till timeout in my unit tests. ...

How to remove the modifier from accesskey

Is there a way to account for all known OS/Browser combinations and have a single accesskey input for a link tag, without the modifier? As noted in Wikipedia (http://en.wikipedia.org/wiki/Access_key) I can have accesskey="d" and I know some users will input Alt+d some Alt+Shift+d. Is there a way around this? How can I allow a user to...

How can Google Data js-client access feeds without any same-origin-policy issue?

I've been reading about the JavaScript Client Library for Google Data Protocol and it seems that it can access any Google service that has a proper interface (Docs, Spreadsheets, Calendar etc.) If I use this client in my own application hosted on my own domain, how does the js client library get around the same-origin-policy that seems ...

Textbox not recognized in Gridview Edit Item Template

I'm trying to use a calendar control to populate a textbox in a gridview cell in edit mode. The error is with this line <a href="javascript:OpenPopupPage('Calendar.aspx','<%= txtGvEditTeDate.ClientID %>','<%= Page.IsPostBack %>');"> It doesn't recognize the textbox. Compilation Error Compiler Error Message: CS0103: The name 'tx...

Will an html image tag execute in the head tag

So a lead tracking company needs a link to fire and it was in the head tag...will it fire. <head> <img width=1 height=1 src='http://track.searchignite.com/si/CM/Tracking/TransactionTracking.aspx?siclientid=4426&amp;DetailDescription=935626&amp;transactionamount=1&amp;SICustTransType=19172&amp;jscript=0&amp;x10=goog&amp;x9=1&amp;x8=9...

Javascript: Mozilla .watch() functionality for all properties of an object (possibly cross-browser)

https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Object/watch The .watch() method does this in short: "Watches for a property to be assigned a value and runs a function when that occurs." Long descriptive form: "Watches for assignment to a property named prop in this object, calling handler(prop, oldval, newval)...

ANDROID WEBKIT: Select elements getting focus events, but not opening!

Hi all, I have a series of select elements in a form on a mobile site. These select elements are inside a scrolling pane handled through JS and CSS3 transforms, so getting a touch/click/whatever event to register on the selects was enough of a pain in the first place. However, I'm now finding, on android only, that even though the selec...

iPad touch events on <video> tag

Hi, I'm building a javascript-powered gallery on the iPad that can display both images and video. To browse the gallery, you can swipe left or right (similar to the iPad's Photo application). However, none of my touch events work when swiping over a <video> element. It seems to take over my touch events, even on elements that may have a...

(rails3) passing ruby variables to javascript file

When rendering a javascript file (not RJS, just a regular JS file) from a rails controller, is there a way to pass variables to it, which can then be used by functions in the JS file being called? I've tried :locals => {} but that doesn't work. ...

++someVariable Vs. someVariable++ in Javascript

In Javascript you can use ++ operator before or after the variable name. What, if any, are the differences between these ways of incrementing a variable? ...

How can I stop text from being selected?

In my web app the user can sometimes click the same button a number of times, skipping through messages and things, causing the </a> to be selected. So how can I prevent this using Javascript (jQuery) ...

JavaScript/Ajax: Populate a Hidden Field

Hey, you programmers have been extremely helpful to me in the past, so I thought I'd ask my question here, again. It's probably a simple fix, but I'm new to JavaScript and Ajax. What I have working is Ajax that writes to a a responseText stating, "LOCATION NOT FOUND" if it is not found when a text field loses focus. What I'd like to...

HowTo - Test JS Touch Events on a Mac

I'm working to build a web app that uses the WebKit Touch Events JS API. How can I QA this app on my mac with touch events, and not be forced to swap between developing on a mac and testing on an iPhone. Ideas? ...

How to get only from string using javascript or PHP?

I have a problem to extract only 'a-zA-Z0-9- _' from string. Example; If i input "A cat นกห 004-1 กกกกก" it show me only 'a-cat-004-1' or if i input "aa مقتطف 4-5 aaa" --> 'aa-5-4-aaa' any idea? ...

AJAX requests in mobile widgets

I've added the code for an AJAX call in my mobile widget but I don't get a response. Any ideas? $.ajax({ type: "GET", url: "http://www.tfl.gov.uk/tfl/syndication/feeds/disruptions-tube-offset-now.xml", dataType: "xml", success: function(xml) {} }); ...

IE "Object Expected" error trying to get img from Java Servlet

I have the following image tag in a JSP: <img id="validationGraph" src="/myapp/MyServlet?mode=myMode" usemap="#validationMap" border="0" onLoad="getImageMap()" /> A Java servlet uses JFreeChart to generate a png image and write it to the output stream. This works fine in Firefox and Chrome, but I am getting an intermittent error in...