javascript

Regular Expression for password validation

Hi, can any one help me in creating a regular expression for password validation. The Condition is "Password must contain 8 characters and at least one number, one letter and one unique character such as !#$%&? " ...

Emacs + js2-mode: disable indenting completely?

I'm using js2-mode for working with javascript in emacs and for the most part it's very useful. However, the indenting methods are terribly frustrating when working with jQuery, closures, and JSON... for instance, code that I wish to be indented like this: var foo = jQuery('#mycontainer ul li').each(function(el){ var bar = el.html()...

Does window.onload means the whole contents have been loaded?

I have a page which has an Iframe. In that Iframe, there are six iframes. When I use window.onload or document.observe(window, 'load', func) // of PrototypeJs, does it mean that all the contents of Iframe and the other 6 iframes' content have been loaded? If the answer is not, then how can I be sure that all my iframes content hav...

Loading successive select boxes on startup with javascript

I am trying to populate select boxes from javascript at start up, with each one depending on the previous one. In HTML code I have <body onload="start_up()"> <span id="FirstList">xxxxxxx</span> <span id="SecondList">xxxxxxx</span> Javascript code is function start_up() { load_select('','Type1') load_select(document.getElem...

How to open a folder using 'openWithDefaultApplication' in Adobe Air 2.0?

How would I create a button that links to an external folder using the openWithDefaultApplication class? I'm new to Adobe Air and developing using Dreamweaver (JS and HTML). Thanks in advance! http://www.adobe.com/devnet/air/flex/articles/exploring_file_capabilities.html ...

Most efficient way to check that string variable is a single alphanumeric character.

I could do it with regex (something like myString.match(/^[A-Za-z0-9]$/)) but it seems like an overkill. What would be more effective performance-wise? Thanks. ...

Convert array to comma-delimited text

Apologies for this embarassingly simple question but I'm still relatively new to javascript. I have an array of names, something like var myArray = ['Hill M','Zhang F','Dong L', 'Wilkinson JS', 'Harris N']; I would like to return a string, with names separated by commas, but with "and" between the final two names, i.e. 'Hill M, Zhan...

.click inside stop: function (event, ui) run X times (where X is the number of items) instead of just once

The code below is (hopefully) a minimized testcase of my original problem. I'm trying to set up a system where you drag list items from the left menu (draggable items) and then drop'em to the box on the right hand side. Once they're dropped, you should be able to click the "draggable item" text and expand their fieldsets. The problem is...

Performance Comparison of HTML Added via Javascript vs. Normal HTML Markup

Has anyone ever tested, or does anyone know, the performance differences of these two different ways of rendering the same html content (other than the fact that one has imported the jquery library and the other hasn't, and that there are two requests in the Ajax version versus one)? Add HTML via Ajax <html> <head> <script src="jav...

From Which Frame alert occurs?

I have a page with six ifrmaes inside it. Each frame has individual id, so it is easy to detect the frame. All these frames have commono src. And each source I set window.onload=function(){ alert(' this has been alerted from Iframe with id#"); } How can I know the ID of the frame from which the alert is alerting? Thanks. ...

Javascript selecting part of a string and converting it to uppercase

I have a string like this: A sampletext b sampletext3 c exampletext A sampletext587 b sampletext5 b sampletextasdf d sampletext4 b sometext c sampletextrandom How do I, in JS, convert all the text on the lines starting with b to upper case? Thanks! ...

Can i execute custom commands in a rich text editor (iframe with design mode on) ?

See this. Is it possible to create custom commands (and how) for the function execCommands? I need custom commands for custom markup. ...

How to generate page numbers using javascript?

How do I generate page numbers for a multi page data set using javascript? Consider there are 55 pages. I want to generate page numbers like this 1 2 3 4 5 ..... 55 next Which is rather similar to the Stackoverflow questions pager Any suggestions? ...

javascript image picker php

im having dynamically created image tags, in php foreach function img scr=asdfsf.gif... so if i click on a particular image the src of the image store in a javascript variable should not use onclick, use binding the image javascript.. ...

How do I test a variable passed into a function?

Quick question, I'm trying to pass a value to a variable and then run a function if the variable was set to something specific. How do I do that? I have the following example where I want to assign the value name to a form field if the variable type is set to 1. function test(name,type) { if (type=1) { document.myform.name.value...

jQuery array problem

I have a problem with populating an autocomplete list based on a previous input. Basically, I have about 40 or so different arrays containing car models and I want to populate the autocomplete list based on the previous input. What I want to do is: Get the value of the previous input (the name of this is the same name as one of the a...

JavaScript Date in this format: "Wednesday, March 03, 2010 05:44:15 PM"

I want to display date like this in my website "Wednesday, March 03, 2010 05:44:15 PM". If I use JavaScript it will take lengthy code. Is there any other way to do this? ...

F#/JavaScript tool?

At a UG meeting I heard about a tool called "web sharper" or "web sharpener" or something like that which is supposed to make it easy to generate JavaScript from F#. Functional JavaScript or something like that. Unfortunately, I seem to have gotten the name wrong and I cannot find it. Does anyone know the name and have a link? ...

it is the fact that the google map does not always line up well in the iframed area?

What are other ways to embed Google maps? ...

using the DOM to add elements, document.write

I have just learned (no thanks to IE) that I cannot use document.write scripts in XHTML. However, it seems there is a way around it by using the DOM to add elements. I don't know. It's foreign to me. Here's the JS: copyright=new Date(); update=copyright.getFullYear(); document.write("Copyright &copy; 2004-"+ update + " flip-flop media"...