Skip to content
Advertisement

Category: Questions

PO Box Regular Expression Validation

Here’s my code, but I can’t ever trigger the alert. Answer In javascript, you have to escape your slashes: Also, you could reduce your pattern a bit by using case-insensitive matching: Note: Your regex also matches on addresses such as: 123 Poor Box Road 123 Harpo Box Street I would suggest also checking for a number in the string. Perhaps

Is there a way to increase the size of localStorage in Google Chrome to avoid QUOTA_EXCEEDED_ERR: DOM Exception 22

I’ve written a webapp that allows you to store the images in the localStorage until you hit save (so it works offline, if signal is poor). When the localStorage reaches 5MB Google Chrome produces an error in the javascript console log: Uncaught Error: QUOTA_EXCEEDED_ERR: DOM Exception 22 How do I increase the size of the localStorage quota on Google Chrome?

Set of objects in javascript

I’d like to have a set of objects in Javascript. That is, a data structure that contains only unique objects. Normally using properties is recommended, e.g. myset[“key”] = true. However, I need the keys to be objects. I’ve read that Javascript casts property names to strings, so I guess I can’t use myset[myobject] = true. I could use an array,

Inmobi API for Javascript based mobile App

Has Inmobi provided API for Javascript based Mobile Application? I am writing Symbian apps using WRT (Web Runtime Widget). These apps are purely written in Javascript. Currently I am unable to find support for such apps from Inmobi. I have to integrate Inmobi ads in those apps. Is there any hack/solution available? Answer We do not have the Javascript based

How can I move a div on scroll?

I have to move a div when the the user scrolls, but need to use pure JavaScript. position: fixed; will not work with the layout. The div’s original position is relative to something else. Is there a simple implementation using an event like onscroll, to detect how many pixels the page moved up or down, and change the position of

Improving regex for parsing YouTube / Vimeo URLs

I’ve made a function (in JavaScript) that takes an URL from either YouTube or Vimeo. It figures out the provider and ID for that particular video (demo: http://jsfiddle.net/csjwf/). It works, however as a regex Novice, I’m looking for ways to improve it. The input I’m dealing with, typically looks like this: 1) Right now I’m doing three separate matches, would

Advertisement