javascript

how would you regex validate a string of mobile numbers?

i need to validate this type of string 0415256987, 0452 654 987, 0411 236589, 0 410 258 987 etc. each number has 10 digits and spaces commas, new line, are allowed. in my project this is a textarea where users enter comma delimited string of mobile numbers. the regex is for the js validation. the spaces and new lines are allowed to...

How to select following input elements and how to get part of the ID using Jquery?

There are many input elements which IDs are question5,question6, question7 ,..., how to select these input elements using Jquery? I do not mean $('#question5'), I mean to select the group of them. Also How to get the the last number like 5,6,7,... using Jquery? ...

Fast diffusing intensity algorithm

Hi All, Firstly apologies for the title, I don't know if it describes what I am trying to achieve but its the best I've got. Basically I have an array describing the intensity over a 2D space. I want to then distribute this intensity to neighbors over a given set of iterations, i.e. Lets say I have the following array: intensity = [ 0...

How to I send data from JavaScript to PHP and vice versa?

How do I go about passing data from JavaScript code to PHP and back. Right now, I do this is a round about way: PHP to JavaScript: I would simply use the inline echo to send the data: <script type="text/javascript"> var data = <? echo $target_variable ?> </script> OR <script type="text/javascript"> var data = <?= $target_vari...

How to send an value from .aspx page to JavaScript file?

I have these functions: function clear(txtvalue) { } function EnableValue (txtvalue, rfvValue) { } <asp:Button ID="btn1" runat="server" OnClick="btn1_Click" onclientClick =" return clear('"+txtValue.ClientID+'"); Text="Button" /> <asp:Button ID="btn2" runat="server" OnClick="Button1_Click" onclientClick ="return EnableValue ('"...

get iphone ID in web app

i want to create a web-app for the iphone and i need to get the ID of the device (instead of username/password). can this be done? ...

Understanding Incrementing

For example this: var a = 123; var b = a++; now a contains 124 and b contains 123 I understand that b is taking the value of a and then a is being incremented. However, I don't understand why this is so. The principal reason for why the creators of JavaScript would want this. Is this really more useful than doing it the PHP way? What...

best practice for dealing with common "structural" elements of pages?

Hi everyone, Very basic question: I am coding a web app that has a handful of pages. These pages have the usual shared elements: eg, the site's header/masthead and a side-bar are present on all pages. The HTML is static (not dynamically generated, its "ajaxy-ness" is done client-side). What is the best way of importing/"including" thos...

how perform .add( .shift() ) on a jQuery object

hello. I'm trying to manipulate a jQuery object to make the first item the last, second the first, third the second, and so on. With an Array this would be simple: myArray = [ "a", "b", "c", "d", "e" ]; myArray.add( myArray.shift() ); // done. How can I do this with a jQuery object? myObject = $('.myDiv').children(); myObject.nowWh...

window.location.replace JS

What does the following code return? window.location.replace("/ak012/(S(sar23pq1ki5wo22qqmmidvie))/HTML/Page.ashx?ID=4") ...

Javascript unit testing in eclipse

I am doing a firefox extension using eclipse and need to know how I can do unit testing for that project. ...

PHP to Javascript Array (Kind of)

Hi, Here in an array i have in javascript, this works great! _rowData: [ { name: "Most Recent", view: "recentView" }, { name: "Most Popular", view: "popularView" }, { name: "Staff Picks", view: "staffView" } ], How could i generate this array from a php script? I want to use AJAX to get the results returned by the php. ...

jQuery selectors - find objects without specified attribute

I have several objects on a page and I want to perform an operation using jQuery only on some of them - the ones that don't have a specified attribute. So: <li style='...'>some text</li> <li style='...'>some other text</li> <li>some very diffrent text</li> and in javascript I would have: $('li[style]').hide(); that would hide all e...

Sorting Javascript Array with Chrome?

Hi all, Is there a way to sort an array using Chrome? Using the sort function does not work as seen in this example: var myArray = [1,4,5,3,2]; myArray.sort ( function( a , b ){ return b>a }); for ( var i = 0; i < myArray.length; i++ ) { document.write( myArray[i] ) } Firefox / IE / Opera / Safri output: 54321 Chrome output...

JSON2.js not recognised by IE 7 or Opera 10.01

I have a page that's working fine in Firefox 3.5.6 but not in IE 7 or Opera 10.01 I'm including the minified version of JSON2.js from json.org in a script tag in the head section. In Firefox the data gets parsed into an object. Opera and IE both throw errors, saying they can't find the JSON object. How can I fix my javascript so that ...

Can we fetch data from webpage using JavaScript?

Hi, I have created few scripts to complete a web registration. Now each time I complete a registration on the last step it generates a 'Registration ID'. I need to capture and save this id to a file. Can we do this with JavaScript? ...

Hideable Comments box

Hi Gurus, I have a time tracking sheet application. In this I will display dates in a week on X axis (on top) and Tasks on Y-axis (downwards). As shown below, I will give a @ icon after every text box for entering comments against each entry. **************************************************** # | Sun | Mon | Tue | Wed | Thu | ...

Resize textbox everytime to fit the text length

In my ASP.NET page I have a text box which shows data which is bind to an (JavaScript) object variable. I want that textbox to resize everytime, the JavaScript object, e.g. result.title will change everytime. Important: I want to fit the textbox exactly to the text length inside. ...

Looking for a JavaScript carousel

I am looking for a JavaScript based carousel such as absolute website. The main part that I am interested in is that it slides in a similar way to the main site flash, highlighting one item/image at a time and items are in a line. Plug-in for any kind of library is welcome but indeed I would prefer jQuery based one as I have used it for...

WebBrowser1 problem with external web app.

the external Application works good in IE so i know the problem is inside My App. The external web app is java applet and java script based, and the problem im experiensing is when the java applet tryes to run a java script. The Applet opens a seconday window with a java script and tryes to do some operations but then i just stops. And ...