javascript

check a checkbox with a regex

What would be the correct regex to check wether a checkbox is checked in javascript? update: i know it is usually not done with a regex. But since its part of a form module and all the validations are done with a regex. I thought this could also be checked with a regex. My quyestion is how. ...

event.preventDefault() function not working in IE. Any help?

Following is my javascript(mootools) code: $('orderNowForm').addEvent('submit', function(event){ event.preventDefault(); allFilled = false; $$(".required").each(function(inp){ if (inp.getValue() != ''){ allFilled = true; } }); if (!allFilled){ $$(".errormsg").setStyle('display', '...

Filter internet based email addresses

How can I go about doing a client side validation for email addresses where the email address has to be a non-internet based one as much as possible. i.e yahoo, gmail and hundreds are not allowed. It doesn't have to be perfect but I just want to minimize all the obivious scenarios of such email addresses being valid. Currently I just us...

Create a hidden field in JavaScript

How do you create a hidden field in JavaScript into a particular form ? <html> <head> <script type="text/javascript"> var a =10; function test() { if (a ==10) { // ... Here i need to create some hidden field for form named = chells } } </script> </head> <body > <form id...

clipboard image directly save in to client side using javascript

clipboard image directly save in to client side using javascript, any sample source code? ...

Dynamically update a <link type="application/rss+xml">

We've tried to dynamically update our rss-links (using JavaScript) in the head section of the HTML-document to reflect changes on the page due to filtering with AJAX. It seems that these do not consistently update across browsers though (go figure...). (edit: By not updating correctly I mean the link in the address bar, not the DOM its...

Time refreshment in the HTML via AJAX

Hi, I have one html page with links of chart whenever i refresh HTML paget the chart refreshs. I heard from my friend that with the help of AJAX that chart will refresh automatically with given time interval without refreshing that html page. please help me with the html code for the same. Regards, Raj ...

Javascript major mode in Emacs

Which javascript major modes exist in Emacs, and what are their key-features ? ...

Javascript Textbox Event

I am facing problem with input text type (ie. Text Box). I have written a function used by the onkeyup event on a Text Box. The line looks like this: <input type='TEXT' value='abc' onkeyup='changeSomething( this );'> But now I am facing problem that when user selects values from the previously entered values, I am not getting any ev...

Using own callback methods for AJAX request in Prototype

I have refactored working code to use proper objects and now I can't get Prototype's AJAX.Request to work properly. The code is following, it's working in context of YUI's DataTable: SearchTable.prototype.setTableColumns = function (transport) { this.dataTableColumns = transport.responseText.evalJSON(); this.dataTableCallbac...

Auto insert date and time in form input field?

Using javascript, how can we auto insert the current DATE and TIME into a form input field. I'm building a "Problems" form to keep track of user submitted complaints about a certain service. I'm collecting as much info as possible. I want to save the staff here from having to manually enter the date and time each time they open the form...

an array of strings as a jQuery selector?

I have an array of strings that are valid jQuery selectors (i.e. IDs of elements on the page): ["#p1", "#p2", "#p3", "#p4", "#p5"] I want to select elements with those IDs into a jQuery array. This is probably elementary, but I can't find anything online. I could have a for-loop which creates a string "#p1,#p2,#p3,#p4,#p5" which coul...

making an ajax request from javascript onclick

I am used to use the helper methods link_to_remote and friends to create links or buttons that will send Ajax request under the hood and update some data of the webpage. I have some which background images are buttons. I want them to send Ajax request to my rails server. I guess a javascript onClick + sending Ajax request should do t...

Why is a JavaScript CSS class breaking this script?

Here's the script- <script language=javascript> function apply() { document.form1.sub.disabled=true; if(document.form1.chk.checked==true) { document.form1.sub.disabled=false; } if(document.form1.chk.checked==false) { document.form1.sub.enabled=false; } } </script> If I use this html it doesn't work-- <input clas...

jQuery coda slider effect navigation stop

Hello. I'm using the Coda Slider effect described here: http://jqueryfordesigners.com/coda-slider-effect/ . It works perfectly but I need one more feature added and I don't know how to achieve this: I want the navigation to stop at the last and first tabs. I want the left/right button to disappear or became inactive if I am at the first...

Yui Datatable with AutoComplete and Pagination

I try to understand how use server-side Pagination for Dynamic Data (I see example : http://developer.yahoo.com/yui/examples/datatable/dt_dynamicdata.html). My problem is I can not customize my request, when I try the pagination, my request is : qct-list.htmlsort=geneid&dir=asc&startIndex=50&result=25 The request should be in the follo...

What would be a better name for Javascript's "this"?

I'm coming from a Java background, with its class-based inheritance model, trying to get my head around Javascript's prototype-based inheritance model. Part of what is throwing me off, I think is that I have Java's meaning of "this" solidly in mind - and Javascript's "this" is a very different beast. I understand that Javascript's "thi...

jQuery x y document coordinates of DOM object

I need to get the X,Y coordinates (relative to the document's top/left) for a DOM element. I can't locate any plugins or jQuery property or method that can give these to me. I can get the top and left of the DOM element, but that can be either relative to its current container/parent or to document. ...

Automatically re-direct a user when session Times out or goes idle...

I want to have a timer going to run every 3 minutes on the page (javascript), to detect if a php session ($_SESSION) has timed out... and if so, redirect them automatically. A good example would be, a user logs in and runs up stairs, and never comes back down... I want the javascript to log them out with a simple redirect... Is this p...

Javascript/Markup in Assembly

I'm trying to somehow render out javascript for a particular user control rather than just having a script include for the javascript file. The reason why I don't want a simple script include is because I need to append unique ClientID's to the dom elements at runtime. I could hardcode the javascript in a function and just append the ...