javascript

jquery error "Invalid property value."

EDIT: This error happens because in IE6 and IE7 these attributes are required for a textarea element. Code: $(document).ready(function () { var ASP_txtNotes = 'ctl00_cphBody_txtNotes'; $("#" + ASP_txtNotes).removeAttr("cols"); // <-- Error here } Error: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; ...

Is there an existing CSS3 selector parser for JavaScript?

Anybody know of snippet that will parse a CSS3 selector like this: "form#network_template[method='put'][action='#form_{keyname}']" to this: { tag: "form", id: "network_template", method: "put", action: "#form_{keyname}" } or this: <form id="network_template" method="put" action="#form_{keyname}"> ...

Using $0 in Javascript's String.replace

I'm highlighting instances of a search string within a set of text. I want to preserve the case of the original text while replacing a case-insensitive match of the query. Here's what I started with: text.replace(new RegExp('(' + query + ')', 'ig'), '<em>$1</em>'); In this case, I'd need to escape query to prevent parentheses from bre...

JavaScript: I have an array. I want to check if the first element is a fieldset.

OK, so here was my original problem. You don't have to read it but in case it helps: http://stackoverflow.com/questions/4001246/firefox-thinks-fieldset-is-a-form-element-chrome-doesnt Basically, Firefox and IE count the fieldset in my HTML as an element in my array, and that screws everything up. But Google Chrome does not count the fie...

Restful communication between local applications is a good idea?

I wonder if it's a good idea letting local applications (in the same server) communicate with each other entirely through Restful API? I know this is not an uncommon thing, cause we already have applications like CouchDB that is using HTTP REST for communication, even with local applications. But I want to take it to a higher level by ...

What is the PHP equivalent of Javascript's Date.UTC command?

How can I say this Javascript in PHP: var ts=Date.UTC(1985,1,22); Thanks in advance. ...

Detect Internet Connection as in Gmail Javascript

I'm creating an HTML autorun. There is no restriction in using javascript as it will be run from XULRunner. I want a way to detect if internet connection exist or not. This doesn't work for me $(document).ready(function() { var online = navigator.onLine; // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/...

How To (Effectively) use jQuery to Match the Value of an Input with a Database?

I've been working on a PHP project of mine, and I am attempting to add a feature that tells the user whether or not the username they entered in a register form is already taken as they update the input. When starting this, I thought I knew how to code this- but I ran into some problems along the way. When I post the data to my PHP scri...

Jquery selectable only with shortcut

I want to let the user select when the shift key is held. $("#div").selectable({ start: function(st) { $(window).keydown(function(e){ if(!e.shiftKey){ st.stopPropagation(); } }); }); no? ...

How to pass parameter in the newElement.setAttribute in javascrip

Hi guys, I am using this code to generate the textbox dynamically by using the javascript.Its working fine .But my issue is all generated textbox have the same name .Is there is possible to prefix the textbox count with the textbox name So that it is easy to post the textbox values. <html> <head> <script>//addElement('INP...

is it possible to prevent iframe content from escaping into main page using js ?

it is often done by code like this: if ( window.parent.frames.length>0 ) {} // check how many frames, if none do nothing else { window.location="[new destination]"; // else change the current location } But I want to prevent iframe content from knowing that it is on the iframe. I am writing a php proxy and content will be from t...

Return a JavaScript's confirmbox response to a ruby program.

Hi all, Sorry if it looks stupid question but is it possible to return the response from a JavaScript confirmbox or messagebox to a ruby program as a value? I click on confirmbox's "yes" button, this response is stored in a variable, and then this variable is returned to ruby? ...

jQuery shortcuts / technique for toggling classes

Hi! In jQuery, is there another way to write this? Version 1 $("#date_filter-enable").click(function() { $("#search_dates").removeClass("hidden"); }); $("#date_filter-disable").click(function() { $("#search_dates").addClass("hidden"); }); Version 2 $("input[id^=date_filter-]").click(funct...

JavaScript: For...Each / With

Possible Duplicate: JavaScript foreach Vs for What's the difference between a for loop and for...in? I mean, if there is a difference, it can't be much. And, I see within validation scripts sometimes the function written like: function check() { with(something) { if(){ // do something } } ...

How I can pass variables from Flex to JavaScript (separate HTML file) and return the other variables?

I need to pass variables from Flex app, process its using the functions and return back to this application. ...

Format date in Ajax calendar

I had Ajax Calendar and I want to prevent user to choose date (Today or future date) I had java script code but It when I prevent me to select date earlier as (10-10-1990).Plaes any one help me. Javascript <script type="text/javascript"> function checkDate(sender,args) { if (sender._selectedDate < new Date()) { ...

How to turn jQuery/Javascript functions into methods

Could anyone explain how to turn functions into methods and the variables into parameters of an object in jQuery/Javascript? And even more interesting Why i should do that? ...

How can i add click handler to x-label element of gwt-visualisation chart

Hi Guys, I am using gwt-visualisation chart But is there any way to add click handler to x-label Thanks ...

Send password safely using an ajax request

Hello, just to know, is it possible to send password through an Ajax request safely? I've a login box that calls an ajax request to try the login/pass and retrieve a JSON Object with errors (if any). Should I use a form redirection instead? [EDIT] Store the encrypted password in the database isn't the solution because the login and p...

HTML onload - using variables as parameters

Hi, I want to use something like: <body onLoad="init('A sentence with "quoted text" as parameter')"> Unfortunately, this does work, as the quotes in the parameter are not treated properly. Escaping the quotes also does not work <body onLoad="init('A sentence with \"quoted text\" as parameter')"> (Above also does not work). How ...