javascript

How to pass a reference to a JS function as an argument to an ExternalInterface call?

Summary I want to be able to call a JavaScript function from a Flex app using ExternalInterface and pass a reference to a different JavaScript function as an argument. Base Example Given the following JavaScript: function foo(callback) { // ... do some stuff callback(); } function bar() { // do some stuff that should happe...

Eclipse outline of Prototype javascript classes

Is there a way to show the structure of a javascript class declared using Prototype's Class.create function in the Eclipse outline view? The declarations look like: var Foo = Class.create({ bar: function() { ... }, baz: function() { ... }, }); At the moment all I get is "Foo:". (A google search turned up http://mar...

Calling AddEventListener in a loop with a variable element name

Hi, I'm trying to do the following: I have a set of images and select (dropdown) HTML elements, 30 of each one. I'm trying to use AddEventListener on a loop from 1 to 30 so that when I change the value of the select, the image src is updated (and the image changes). The AddEventListener function is this one: function AddEventListener(...

jQuery: Adding One to Number Inside Element

I'm trying to add one to a number inside a p element with jQuery, but it doesn't work. $(document).ready(function() { function addOne() { var number = $('p').html(); return number++; } $('p').text(addOne()); }); ...

How do you clear the focus in javascript?

I know this shouldn't be that hard, but I couldn't find the answer on Google. I want to execute a piece of javascript that will clear the focus from whatever element it is on without knowing ahead of time which element the focus is on. It has to work on firefox 2 as well as more modern browsers. Is there a good way to do this? ...

where is the 'googleBar' in google maps api v3..

i write this in api v2: map.enableGoogleBar(); i want to using v3,but i can't find enableGoogleBar function, where is it ? thanks ...

JQuery response is null but actual response is not

I'm using JQuery to make an Ajax call. I used a sniffer to catch the response text: {"error_code":0,"message":"SUCCESS","data":{"session_token":"3efd9dde-a839-4e91-9415-4c2f6cba5b7b"}} But the response returned on the success callback is null. Anyone got any ideas? (see jquery code below. Jquery code: $.ajax({ type: "GET", u...

jQuery menu active link

Hello, I am trying to make a jquery menu that when I click on one of the links (without reloading the page), it changes its class to "active" and removes this class when I click on another link. here is my code : <script type="text/javascript"> $(document).ready(function() { $(".buttons").children().("a").click(function() { $(".b...

Regular Expression for finding font-style in html style

Any idea how to find and replace the HTML font-size in style attribute? eg. <span style="font-size:12px">hello world</span> I would like to remove all font-size using javascript. Thank you ...

jquery: prepopulating autocomplete fields

I'm using the tokenizing autocomplete plugin for jquery ( http://loopj.com/2009/04/25/jquery-plugin-tokenizing-autocomplete-text-entry ). I mostly use Ruby, and I'm really unfamiliar with javascript, though. My basic setup looks like this, and works fine for a new, blank form: $(document).ready(function () { $("#tag_ids_field").token...

onsubmit() does not work.

Here is something that I find disturbing. I created a small form, and I'm using AJAX to validate for me. I have a javascript function authenticate() that works sometimes. <form method="post" action="" id="login_form" onsubmit="authenticate()";> // various inputs <input type="button" onclick="authenticate()" value="Log In"> </form> ...

How would this code be refactored to use jQuery?

How would this code be refactored to use jQuery? function emleProcessOnLoad(aThis) { var result = document.evaluate("//span[@class='emleOnLoad']", aThis.document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var jj=0; jj<result.snapshotLength; jj++){ eval("var emleThis=result.snapshotItem(jj);" + result.snapsh...

jQuery UI not binding on popup windows

I get my datepicker control to bind fine to anything with a class of calendarTrigger on any of my pages, however on Popups (Of which use a Master Page and have the script files on it's master page) they don't bind to trigger datepicker UI elements. Is there something I am missing ? jQuery Code Held Within the UserInterfaceScripts.js ...

What is the relationship between domNode and htmlelement?

Hello, I am confused about the two terms. What is the difference in browser-side javascript programming? I use dojo as framework. And there is only the concept of domNode. But browser debugger always told me something as htmlelement. Are they just the same thing with different names, or with some subtle differences? Thanks. ...

How to get Custom Property from ASP.NET Textbox using javascript?

I have created a custom text box with property "key"(ASP.NET C#).I want to get the value of this property "key" using java script.How can I do this? ...

Why is the data I am printing not in a table format

Hi This is my program .when i submit the print button i can print the datas but they are not aligned in the table formatthe format in which i need the print to be...How can i print in the correct format <html> <head> <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js" > </script> <script typ...

Javascript/PHP popup page problem

I have a program in PHP that allows user to pop in a message, for confirmation from user. As seen below is the link i used. From inbox.php: echo "<a href='inbox.php' onclick=\"popup('acknowledge.php?id=$id')\"><font size=1px color=maroon>acknowledge</font></a></td>"; From acknowledge.php: if ($_POST['no']) { header("location: i...

Format a textbox like "0.00"

Hi How to format a textbox like "0.00" using Jquery or Javascript...If i enter value 59,then it should become 59.00.If i enter value as 59.20,then it should same....How it possible .... ...

Calling ASP.NET Code Behind function from Javascript

Hi, Is it possible to call ASP.NET codebehind function from Javascript. Thanks. ...

scroll into view the selected element

hi all, i am new to javascript.. i have two select boxes with multiple selection enabled.When i select an element from first select box it scrolls into view the corrosponding element from the second list.The single selection goes fine in all browsers explorer,firefox,chrome. now, if i select the first,last element from the first select...