javascript

IE7 regex issue - Regex that work in every browser does not work in ie7

I have a regex validating a password value to be > 6 < 25 characters with at least one number. var passwordRegEx = /^(?=.*\d)(?=.*[a-zA-Z]).{6,25}$/; if(!#quickRegister_Password').val().test(pass)) { errorMgs += 'Your password must be at least 6 characters and have at least 1 number and 1 letter.\r\n'; } It works in Firefox, Chrome...

javascript date and year

I have the following javascript code: <script type="text/javascript"> $(function () { var currentDateTime = new Date(); var oneYear = new Date(); oneYear.setYear(oneYear.getYear() + 1); alert(currentDateTime + "_" + oneYear); }); </script> i would expect the alert to output the current datetime ...

taking off the http or https off a javascript string

I have the following strings http://site.com https://site.com http://www.site.com how do i get rid of the http:// or https:// in javascript or jquery ...

jQuery Tablesorter Static Rows

I've been struggling to find an answer to this question. That is, how would I have a static row that doesn't sort or move up and down? The reason for this is to have repeated headers in a very large table. The multiple headers Would anyone be able to help? http://tablesorter.com/docs/ $("#dataTable").tablesorter({ sortL...

Regular Expression in exactly this form : Tyler Durden

Hi i need a javascript regex for a name field in my html form. The user should be able to enter multiple names seperated with space. And first character of all names should be a capital. No numbers, special chars. etc. thank you. ...

What is a C/C++ data structure equivalent in Javascript?

Lets say I have the following in C struct address{ char name; int id; char address; }; struct address adrs[40]; //Create arbitrary array of the structure. 40 is example adrs[0].name = 'a'; id[0] = 1; ... What is the equivalent way of defining and creating array of a user defined structure. Thanks ...

Want to get all the text inputs from a form and put them in a JavaScript alert. Why isn't my code working?

My HTML contains a fieldset, six text input fields formatted in a table, and a submit button. The submit button includes the attribute onClick="check()" and it's worked with simpler alerts so I know that's not the problem. Here's my JavaScript: var $ = function (id) { return document.getElementById(id); } function check() { var x...

Testing javascript pops iwth Selenium

The website has a link for bookmarking the page and when this link is clicked a JavaScript pop-up opens. Is there a way to verify the contents of this pop-up. I've tried getalert() but it looks like the alert isn't even recognized. Another link opens a totally different going to a different URL. I sit possible to test whether clicking t...

JavaScript Object/Array access question

Set an object, with some data. var blah = {}; blah._a = {}; blah._a._something = '123'; Then wish to try and access, how would I go about doing this correctly? var anItem = 'a'; console.log(blah._[anItem]); console.log(blah._[anItem]._something); ...

Open Google Maps info window on click outside map

I understand how addListener works within the map itself, but how can I get an info window to open up when I click an element outside the map? For instance, a div with the id #test? ...

OSX Dashboard widget command line access problem

I'm trying to access command line from a simple Dashboard Widget on Snow Leopard. My intention is to fill the contents of the widget from a command-line script I call. This should be possible. I'm calling the script every time the widget is shown using it's onshow callback: if (window.widget) { widget.onshow = onshow; } functi...

How to center the label on the screen?

I'm specifing the size of the windows within the window.open(), but regardless of the size, I would like this label to be exactly on the center of the screen (vertically and horizontally): <?xml version="1.0" encoding="UTF-8"?> <window sizemode="maximized" hidechrome="true" id="weatherWindow" title="Window" xmlns="http://www.mozill...

Running JavaScript function before page load (setting background of appropriate size)

I've got an image background which content I want to be always visible, no matter what is the user's resolution. Therefore, I want to be able to determine what is the resolution and set appropriate background image file before page loads, on the very beginning. Is it possible somehow? ...

Display WMS Layer Based on Zoom Level

Hello StackOverflow, I've been at this all day long and honestly I'm out of ideas. I have some WMS layers that I would like to display/not display depending on the current zoom level. Yes, I have went through the API docs and they seem to be clear as day, but I follow everything that is suggested and I'm not getting the results desire...

alter group element with jquery

I have 3 textarea with a default text "Write something". Let say if i click on one of them, the default text will disappear and that textarea get focus. However, if i click on another textarea, the default text of another textarea will disappear but the default text of first textarea will reappear. How can I make this happen? Same thing ...

GPS coordinates: 1km square around a point

Greetings, I was hoping someone out there could provide me with an equation to calculate a 1km square (X from a.aaa to b.bbb, Y from c.ccc to c.ccc) around a given point, say lat=53.38292839 and lon=-6.1843984? I'll also need 2km, 5km and 10km squares around a point. I've tried googling around to no avail... It's late at night and was ...

Node.JS General Comet Inquiry

I'm trying to take up node.js for a comet-based program. Essentially I'm going to have information coming in from either an SQL database or a XML feed, but the end result needs to be the same. I'm confused upon the implementation and here's my road blocks, help would be greatly appreciated. Streaming - I've been able to build simple mo...

Jquery File Tree - how to return folder name on folder click

Hi, I have installed and trying to customize Jquery File Tree so that, on click of folder name, the folder name and path are returned to the calling function. Currently it only expands and collapses folders, and returns the file name on click of file. So I need to return the folder too and cannot see where that is triggered. I am usi...

Cannot Seem To Get This AJAX Code To Run.

I am trying to learn how to use ajax and i cant seem to figure out why the below code does not work. All it does is first create a valid XMLHttpRequest object when the page firsts loads and then inserts some text into a section of the pages div area. Demo.js var ajaxRequest; // The variable that makes Ajax possible! function newReques...

AJAX response: sugestions for JSON format?

Say I submit a form via Ajax and need a response from the server: Pass/fail indicator On fail, a list of validation errors with associated field ids/names, etc Is there a standard or best practice for the JSON format for such a structure? If so, I'd like to try to stick to it instead of coming up with my own convention. ...