javascript

Dynamic Forms, Microsoft JScript runtime error: 'b' is null or not an object

I get an error while adding a partial form to my current form (kind of parent/child). The partial form is loaded with ajax and there can be none to several partial forms/childs. I got it working that every partial form gets an ID and I can save etc, but everytime I click on the ActionLink I get: Microsoft JScript runtime error: 'b' is...

Regex for url validation (unterminated parentheticals error)

I have the following expression to validate a URL but it gives me a syntax error on the browser. I am no expert in regex expressions so I am not sure what I am looking for. I would also like it to test for http:// and https:// urls. "url":{ "regex":"/^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$/", "alertText":"URL must start...

ajax :populating 2 drop down boxes via ajax using value of the third one

i hava a html page with 3 drop down boxes. When i change one of the box the value in that box is sent to server and the server shold returns the values of the other 2. How will i populate the othere 2 drop down boxes depending on the value of first one. All valuses are obtained frm server side. EX dd1 , dd2, dd3 where dd= drop down box...

jQuery: Target all except ___?

I'm looking for a way to select all elements on a page, except those with a specified DOM location.. Here's an example of what I'd like to do: jQuery('*').except('.ignore').bind('click', function(e) { ... }); Is this possible in a "native jQuery" way? ...

Drupal 6: onkeyup event to a custom form field

How can I add a onkeyup event to a custom form field in Drupal 6? ...

Call base method in Javascript using Douglas Crockford's functional inheritance

Basically how do I call a base method using this patter below? var GS = {}; GS.baseClass = function (somedata) { var that = {}; that.data = somedata; //Base class method that.someMethod = function(somedata) { alert(somedata); }; return that; }; GS.derivedClass = function(somedata) { var that = GS.baseClass(somedata);...

How do you begin building a firefox addon that alters/replaces the default download feature?

I want to write a firefox addon that replaces my current default download feature. I basically just want to add other options to the download window that will allow it to interact with my website. Where do I get started with this? Does anyone know any code I can get started from? I'd rather not build the entire download from scratch, i...

jquery: when does $("???") scan the whole DOM?

When using $("#xxx") I guess under the hoods jQuery uses getElementById. What about $(".xxx") does it scan the whole DOM every time? ...

ASP.NET AJAX Error - null is null or not an object

I am now starting to use Telerik's ASP.NET AJAX controls for 2009 Q1 on my 3.5 web application. IN IE7 (in FF it works fine), whenever I hit a particular page, I get a javascript error stating "'null' is null or not an object" Looking this issue up, I have found various people saying it is due to an issue with validators and upda...

Alternatives to javascript function-based iteration (e.g. jQuery.each())

I've been watching Google Tech Talks' Speed Up Your Javascript and in talking about loops, the speaker mentions to stay away from function-based iterations such as jQuery.each() (among others, at about 24:05 in the video). He briefly explains why to avoid them which makes sense, but admittedly I don't quite understand what an alternative...

XMLHttpRequest, FireFox Extension, and error code '1012' (Access Denied)

I'm working on a FireFox extension that uses XMLHttpRequest to grab data from a remote server. The javascript code is as follows: function _PostBackObject(data) { var postBack = new XMLHttpRequest(); postBack.onreadystatechange = function(){ if (postBack.readyState == 4) { if (postBack.status...

Simulate Keypress With jQuery

Hello, Using jQuery, how can I simulate (trigger?) a KeyPress when a link is clicked? For example, when a user clicks the following link: <a id="clickforspace" href="#">Click Here</a> Then, by clicking the link, it would be as if they pressed the "spacebar" on their keyboard. Something like this, I'm assuming: $("#clickforspace")....

Regex search & replacing the expression with something different for each occurrence of the expression

I am using a vendor-supplied API that uses javascript to output HTML that essentially looks like this: <li class="parent_class"> <a href="link1.html"> Parent Name </a> </li> <div class="child_class"> <li> <a href="link2.html"> Child Name 1 </a> </li> <li> <a href="link3.html"> Child Name 2 </a> </li> </div> <li class="parent_clas...

Making DiveIntoPython3 work in IE8 (fixing a Javascript performance issue)

I am trying to fix the performance problem with Dive Into Python 3 on IE8. Visit this page in IE8 and, after a few moments, you will see the following popup: I traced down the culprit down to this line in j/dip3.js ... find("tr:nth-child(" + (i+1) + ") td:nth-child(2)"); If I disable it (and return from the function immediately), th...

implementing data grid using jquery

I need to read data from a csv file & display it as a data grid.The csv file contains name value pair i.e. column A will contain name & column B will contain its value.Also the user can add a blank row to the end of it & insert data manually by clicking on an add button.The user can select any row & delete the row completely by pressing ...

Encrypt in C# decrypt in JavaScript

I am looking for way to encrypt string in C# and to decrypt it using JavaScript. JavaScript in this case is a scripting language for internal system, so I should not worry about people accessing private key/password which will be required for decryption. Searching online for solution it seems that AES encryption should do the trick. I’...

Problem with Sys.UI.DataView and javascript

I'm using Microsoft Ajax to dynamically populate a list of contacts, given a json packet. My code is as follows: function fillContactsFromData(contacts) { // this is just for debug to let me know that the data is correct if (contacts.length > 0) { alert('ID: ' + contacts[0].ID + ', Name: ' + contacts[0].Name); } ...

How can I get and put a value into a certain column and row?

I am having difficulties doing this program. It's transportation method using intuitive approach. you will first create two inputs that will describe how many rows and columns will the user wish to have. and then, after clicking a submit button, a desired number of rows and columns will appear. then the user will input the number of valu...

Limit words in a textarea

I've done a bit of searching on this. Found plenty of scripts that counted characters and even counted words but couldn't find one that removes any words that go over the word limit.... Here is my script so far...: var maxWords = 10; function countWordsLeft(field) { totalWords = field.value.split(' '); if (totalWords.le...

Checking whether clearInterval has been called?

Given this code: bob = setInterval(function, 1000); clearInterval(bob); Is there now a way to know if that interval has been cleared? Currently, I keep track of this myself, by unsetting 'bob', but I'm curious if my extra line of code is unnecessary: clearInterval(bob); bob = null; if (!bob) itIsCleared(); Thanks! ...