javascript

jQuery selector bug? composed selector vs. simple selector & find()

Something is very awkward about my situation... i have something like this: <div id="selector"> <input type='radio' /> <input type='radio' /> <input type='radio' /> </div> if I use $("#selector input[type=radio]") all three elements are found, but if I use $("#selector").find("input[type=radio]") or even find("input") only th...

Best way to debug Javascript on an iPhone app?

I'm doing some rough development on the iPhone. I'm writing a native iPhone app, which uses an UIWebView object to load web sites with javascript. I find very difficult to debug the javascript code on an iPhone. What are the methods/techniques available for this matter? ...

Can we access the webpage's javascript from the firefox extension.?

I am in the process of creating my first firefox extension and I got to call a javascript function defined in the webpage where my extension will work. Can I access it from my firefox extension? any sample example would be appreciated.. Thanks in advance. ...

How do I call a dynamically-named method in Javascript?

I am working on dynamically creating some Javascript that will be inserted into a web page as it's being constructed. The Javascript will be used to populate a listbox based on the selection in another listbox. When the selection of one listbox is changed it will call a method name based on the selected value of the listbox. For examp...

GWT MouseWheelHandler not working in Firefox

I'm trying to make a TextBox that will change value when someone scrolls the mouse wheel over it. Specifically, my goal is for the number in the text box to increase when i scroll up, and decrease when i scroll down. However, I'm having trouble figuring out the MouseWheelHandler. I simplified my code to just change the value to "UP" or "...

How to set the position of the Ajax modalpopupextender

Can the position of the Ajax modalpopupextender be set either to an absolute or relative position on the page? The default puts it at page center and I haven't found a way to override this. I would like to position the popup close to the control that triggers it. ...

First Time Script

Hi, when you first land on this site you show a first time div tag appear up top (like a toolbar) which sits offering a link to the FAQ page. Nice touch! Is this done with jQuery or do you have an example of the code? Any help appreciated. Thanks! ...

Detect location of script not the page where it is called from

Hello, I am wondering if I can somehow find out the location of the script and not the page it is called from. e.g. if the page is http://xxx.yyy.com/a.htm, and I write location.href, I get that location instead of http://aaa.zzz.com/script.js where the script resides. Is it possible to get the location of the script? Thank you for you...

Javascript/Prototype scope confusion

I'm creating a JavaScript class (using Prototype) that will set the page state to idle if there's no mouse movement within a specified number of seconds. When the mouse moves, the class will "wake up" the page by sending a message to a list of listeners. The thing I don't understand is that this.handlers is valid in one function (setIdl...

Javascript literal loses its variables when called with setTimeout

Hi, I have this piece of code, and it doesn't work as I expect (it's demo code, distilled from a larger program): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Test</title> <script language="javascr...

Firebug vs. Safari Javascript debugger

[DISCLAIMER: My development machine is running OS X Tiger, so my question and experiences are specific to that. But I would not mind hearing feedback on Webkit for Windows.] I've been a longtime Firebug user, but I've grown tired of it's twitchiness. I'm talking specifically about when it will not stop on breakpoints, lose the current...

"Floating" annotations with HTML/CSS/JavaScript/whatever

I have a text document with some annotations, and I would like to make them appear near the text they accompany, on a webpage. That is, I want to convert something like this: The Houdan hen was never drawn into the cult of Sredni Vashtar. Conradin had long ago settled that she was an Anabaptist. He did not pretend to have ...

jquery ajax: call function when all requests are complete

I have two concurrent ajax calls on the page. I want to call a function when both of them are complete (and successful). An inefficient solution: make ajax call A on success for call A, make call B on success for call B, call the function Unfortunately, this breaks the concurrency. Any other way I can accomplish the same effect? ...

JavaScript string and number conversion

How can I do the following in JavaScript? Step (1) Concatenate "1", "2", "3" into "123" Step (2) Convert "123" into 123 Step (3) Add 123 + 100 = 223 Step (4) Covert 223 into "223" ...

jQuery & PHP and MYSQL IE Problem

Now All of this code works fine in Firfox but in IE the divs dont change when the php infomation changes. Can some one help me please as i am working on a project and this is holding me back Thank you. Here is the jQuery Code: $.ajaxSetup({ cache: false }); $(document).ready(function(){ $("#not").css('display','none'); $("#fonline")....

Why avoid increment ("++") and decrement ("--") operators in JavaScript?

I'm a big fan of Douglas Crockford's writing on JavaScript, particularly his book JavaScript: The Good Parts. It's made me a better JavaScript programmer and a better programmer in general. One of his tips for his jslint tool is this : ++ and -- The ++ (increment) and -- (decrement) operators have been known to contribute to bad...

jQuery Navigation Menu Plugin Recommendations

There are 62 jQuery Plugins for menus listed on the jQuery website. I want to select one for my navigation menu that has many users and is well-formed. What is your favorite jQuery Menu Plugin? ...

How can I reduce maintenance when my JavaScript and C# codebases overlap?

I have a library with some objects that I use both from C# and JavaScript. There are several objects, let's call one of them Foo, with the same basic implementation in C# and JavaScript. When I want to transmit an object of this type from the server to the browser, I simply call Foo.ToJson() to serialize this object to JSON and then revi...

checkboxes checked when mysql row = true?

Hi, I am making a page where the user can set there own settings. I need a loop to check the checkbox when the row is true and to be unchecked when its not. How would I go about this? in php/javascript. Thanks echo "<form method=\"post\">"; echo "<table> <tr> <td>1</td> <td><input name=\"checkbox[]\" type=\"checkbox\" id=\"checkb...

Improving my file i/o algorithm

For a given set of text files, I need to find every "\" character and replace it with "\\". This is a Windows system, and my scripting language options are Javascript, VBScript, or Perl. These files are largish (~10MB a piece), and there are a good number of them (~15,000). I've already come up with the following Javascript: function...