javascript

Problem loading remote script with jQuery multiple times in Firefox

Hi! I have a script element in my webpage, something like this: <script id="myscript"></script> Now, from a javascript file, I'm doing something like the following: $('#myscript').src('http://foo.bar?callback=somefunc') Now this remote script 'returns javascript' of the following form: somefunc(somearg); When I run all of this,...

How to create modal alerts/confirms in Javascript?

I am sifting through prompt() and confirm() replacements for JavaScript. I need to create a couple of confirm()s and alert()s that have three or more options. I would like to use the Lightbox class that I am using already. However, none of the replacements I have found can return the result of the operation directly like confirm() and pr...

Search a JavaScript object

Hi I have a JavaScript object like this: [{ name : "soccer", elems : [ {name : "FC Barcelona"}, {name : "Liverpool FC"} ] }, { name : "basketball", elems : [ {name : "Dallas Mavericks"} ] }] Now I want to search on this JavaScript object in the browser. The search for "FC" should give m...

Creating Bing Image Gallery using Javascript

Hi, I would like to design a home page for a client similar to the Bing homepage which would have an image gallery with navigation bars and text right above the images. How can this be achieved using Javascript? Thanks ...

Clear gridview using javascript/jquery.

Afternoon all. Another hour, another question! I have the following bit of jquery up and running that essentially 'resets' control contents. tbxProdAC.Attributes.Add ("onclick", "$('#txtbxHowMany').val(''); SetRadioFocus('" + radProd.ClientID + "');"); I have a gridview that pops up occasionally (don't worry, I have got...

One page Codeigniter site using jquery? ajax?

Hello, I am hoping for some advice, imagine if you will will you are on a website and you are greeted solely with navigation menu, on click the navigation menu that is situated within the left hand side of the screen you can add various content to the right side of the screen that is loaded in individual ‘divs’ then collapsed in accordi...

Using return instead of else in Javascript

I am working on a project which requires some pretty intricate Javascript processing. This includes a lot of nested if-elses in quite a few places. I have generally taken care to optimise Javascript as much as possible by reading the other tips in SO, but I am wondering if the following two constructs would make any difference in terms o...

How to get a reference to the Window object using GWTQuery?

The title pretty much says it all. I'm trying to use jQuery's ability (hoping GWTQuery has implemented it) to pass a callback function to the window.resize something like this(example from jquery site): $(window).resize(function(){ alert("Stop it!"); }); but when I tryi to type $(window) in Eclipse I get an error that window can not...

How to Submit part of a TextArea/anyfield using JS or DHTML or any other way?

I want to submit part of a TextArea (User has entered Multiple Lines and selected one line either by Highlighting or by placing the cursor on the line). If user press the Submit Button then, I need to get the Line or word user has selected. Just for my requirement Understanding See Below Example Ex:- TOAD, SQL Server : where we can ent...

Attributes.Add - works independently, not together

Hello all I have two attributes I would like to assign to the same event: ddlBuyer.Attributes.Add("onclick", "$('#tbxProdAC').val('');"); ddlBuyer.Attributes.Add("onclick", "$('#txtbxHowMany').val('');"); If I comment one out, the other other works fine. But if I just leave both lines in, only one is fired. Can someone explain t...

Stop your code injecting javascript twice?

I have a method that does something, and it puts a javascript method into the page that it uses. I need to make sure that it only puts the javascript method in once regardless of how many times it is called. What's the best way to do this? Can I search the section of page that has rendered so far and see if the method was already create...

Javascript CPS (continuation passing style) implementation

Because of an article in IBM Developer Works about CPS (continuation passing style), I'm trying to not use "return". without CPS function getter() { * calculate a* return a; } function test() { *part 1* if(*condition*) { a = getter(); } *use a* *part 2* } transition the rest of the function ...

Using Javascript to 'sum selected cells' in IE6

In excel it is possible to highlight a range of cells and view the 'sum' in the 'status bar'. Can this be done in IE6 using Javascript and a HTML table ? ...

jQuery IE easing error

Hi, I'm experiencing a strange error in IE on this site: http://www.davenuttall.co.uk The fund-raising barometer on the left-hand side animates upwards to the correct position just fine in all other browsers, but throws an 'invalid argument' error in IE. I think it's caused by the easing method - easeOutElastic - from the easing plugi...

Toggling between instances of NiftyPlayer on a page - won't stop playing when hidden on IE

Hi, i've got a page with links to MP3s, when the link is clicked I use javascript to show a small Flash player (NiftyPlayer) under the link. When a different link is clicked, the old player is hidden and the new player is revealed. The player auto-starts when the element is shown, and auto-stops when hidden - in Firefox. In IE it will ...

Get the slope from one point and an angle in degrees.

In javascript, I am trying to draw a line that is at an angle that is user defined. Basically, I have a point (x,y) and an angle to create the next point at. The length of the line need to be 10px. Let's say that the point to start with is (180, 200)... if I give it angle "A" and the (I guess)hypotenuse is 10, what would my equation(s...

How to pass content of image file from fileupload control to web method via javascript?

Hello! I have a problem with using binary content of file. I want to pass web method content of file. I retriev it from fileupload control on my page via javascript function getAsBinary(). But error appears in web method, when I try to create example of class Image. So, I have the page (.aspx) with fileupload control and scriptmanager. T...

Controls' visibility property, modified by JavaScript, is ignored after postback

My javascript code modifies some properties, visibility included. After postback, some properties stuck, others are "forgotten". Here I try to change the Text property of a textbox and the visibility property of a label to 'hidden'. After postback, the text is preserved, but the label is shown. I would very much like to keep the label hi...

Scaling multiple images to fit inline in a div?

Is there an efficient way to scale a number of images so that they can fit inline inside a fixed-size div? I'm assuming it would be possible to do by using javascript to calculate the div width, divide it by the number of images (excluding padding) and then resizing the images equally to keep their aspect ratio but I'm hoping there is a...

Replacing fields with jQuery

Why is line 10 returning null? http://pastie.org/720484 it works with line 40 ...