javascript

jQuery each tr.children is undefined in Firefox 3.0

I have a snippet of code that I'm working with to filter rows in a table. It works perfectly in every browser other than Firefox v3.0.x (works fine with 3.1 beta 2). When I run the snippet in Firefox 3.0.x, it says that children is undefined. I am using jQuery v1.2.6 also. Code Snippet: var bodyRows = $("#resultsTable tbody tr"); bo...

Linked drop down lists and load div

Hello ! I`m kind of new when it comes to programming but am trying to learn. What I need to do for my site is have 2 or 3 linked drop down menus so when I select an item from the first one, the second one will refresh with other options. I have found a way to do this using java but I cannot seem to make it with the refresh div part. I l...

Cross browser AJAX function to dynamically load HTML

I'm looking for an AJAX function to dynamically request an HTML page. I already found the following: function ajaxinclude(url) { var page_request = false if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject) // if IE { try { page_request...

How to store arbitrary data for some HTML tags

I'm making a page which has some interaction provided by javascript. Just as an example: links which send an AJAX request to get the content of articles and then display that data in a div. Obviously in this example, I need each link to store an extra bit of information: the id of the article. The way I've been handling it in case was to...

Asp.Net ViewState lost with RegisterClientScriptBlock

I am validating a zip code using Javascript that is generated server-side, and injected when a LinkButton is clicked. Then, I retrieve the return value by calling a server-side function when the page loads. This works nicely, but the problem is that the ViewState is completely lost after PostBack. Below is the code, starting with the p...

Do you use jQuery, extJS, or other javascript libraries with Actionscript and Flex?

Since Actionscript is a proper superset of javascript, it should I suppose be possible. Do you use/have you used any of the the javascript extension libraries with Actionscript/Flex/Air? ...

How do you access the matched groups in a javascript regex?

I think I must just be really tired, because this should be really simple, but it's just not working for me. I want to match a portion of a string using a regex and then access that parenthesized substring. var myString = "something format_abc"; // I want "abc" var arr = /(?:^|\s)format_(.*?)(?:\s|$)/(myString); console.log(arr); ...

JavaScript synchronous custom prompt

Hello, I need to use a custom prompt, just like the one shown in this jQuery plugin demo. The problem is, all custom prompts depend on a callback, they are asynchronized, i need them to be synchronous. I need to do something like: alert("Your name is " + myPrompt("What's your name?")); Where myPrompt is a modal custom synchronous pr...

Lazyweb: Need javascript that removes li elements based on visited class of a element

Hello, I've got this page which has a lot of data I don't need, as I've already clicked on it, but it repeats often so I have to visually look for blue. I realized this could be more efficient, and asked a CSS friend if I could set the element to hidden based on whether or not the containing link has been visited. Apparently you need ...

Preventing to execute a javascript function more than once

Dear All I am using Javascript JQuery and PHP. My doubt isHow to limit the javascript function to execute once? My MainJQuery file has ajax, display.php ,it execute for a while .... $.ajax({ type:'POST', url: 'display.php', data:'id='+id , success: function(data){ ...

The same script using two js files?

I admit, I don't know too much about javascript, mostly I just "steal and modify" from Javascript.com and Dynamic Drive. I've run across a few scripts that call two .js files <script type="text/javascript" src="lib/prototype.js"> </script> <script type="text/javascript" src="src/aptabs.js"> </script> and was wondering why, can I...

Why is a matched substring returning "undefined" in Javascript?

I came across a strange behaviour when doing some regexes in Javascript today (Firefox 3 on Vista). var str = "format_%A"; var format = /(?:^|\s)format_(.*?)(?:\s|$)/.exec(str); console.log(format); // ["format_%A", "%A"] console.log(format[0]); // "format_undefined" console.log(format[1]); // undefined There's nothing wrong with ...

Actions on page reload/refresh in JavaScript

Hi What I want to do is trigger a function from an extension/GM Script once a page in FireFox reloads/refreshes... Picture this: I goto a webpage that asks for a username and password. My code populates these values and submits the credentials The webpage reloads and brings up a page asking me to enter a pre-decided number I enter th...

Identifying unique hits with javascript

Could you suggest an efficient way to identify a unique user with javascript (e.g. calculate an hash to send to the server side)? EDIT: The point is that I can't 'intrude' into the browser (e.g. send cookies). And IPs are also not the option. And it has to be a client-side solution (therefore javascript). ...

Post your short extension functions goodies for jQuery

In a similar vain to the c# extension topic on SO It would be great if we could pull together a whole host of useful jQuery function extensions. Please Note the idea is to have short snippets of code not full blown well known plugins or ui widgets ...

Turning numbers into colored bars automatically in HTML/Javascript

Hello, I want to auto-generate a HTML table from some custom data. One of the columns in my data is a number in the range 0-100, and I'd like to show it in a more graphical way, most desirably a colored horizontal bar. The length of the bar would represent the value, and the color would also change (i.e. below 20 it's red, etc.) Someth...

Javascript: Is it possible to get hold of the mouse position outside of an event handler?

I want to get hold of the mouse position in a timeout callback? As far as I can tell, this isn't possible, though one work around might be to set an onmousemove event on document.body when one needs this information and to save this position somewhere. This would be rather expensive however, and is rather hackish. ...

JSON Security

Hi, Do Pagemethods and Json have security risks?(I dont use cookies).Forexample i have a pagemethod and i am sending user id as a parameter but i dont want to show it to user.Can user get user id from pagemethod? ...

Concat JSON objects

I have two JSON objects with the same structure and I want to concat them together using Javascript. Is there an easy way to do this? ...

Getting my head around jQuery

OK, I'm designing a site and thought I'd stick some jQuery in as I really need so js experience. Page with my problem is here: http://new.focalpix.co.uk/moreinfo.php JS in question is: $(document).ready(function(){ $(".answer").css("display","none"); $("#maincontent a.animate").click(function() { $("#maincontent .answer...