javascript

Will removing an iframe from the DOM always stop an upload POSTed from that iframe?

I'm doing some async file uploading with iframes, and I'm wondering if simply pruning the iframe from the DOM is enough to cancel an upload. This discussion seems to imply that this a poor approach to the problem overall, but annoyingly the JS `expert' refuses to reveal his solution. Anyway, removing the iframe works in Gecko + WebKit,...

Javascript that prevents XSS

Hello, is there a way that I could automatically format the input box via Javascript that prevents XSS before the user tries to click on the submit button? like for instance, after a user types a script attack on a textbox, the javascript automatically formats the value within the textbox to a safe format. btw, i'm not just relying on...

How to utilize javascript on Adobe Dreamweaver CS4

Hello. I am working on my personal website and am learning javascript (started yesterday) - My computer is a Mac and I couldn't find on the Internet how to utilize javascript on Adobe Dreamweaver CS4. Specifically, I am trying to use a photo slideshow called Galleria. On PCs, they say to drop the .js file into one of Dreamweaver's folde...

How do I detect height of an image in jQuery?

I tried the following code: var origh1 = $('img:first').height(); alert(origh1); But it alerted a value of '0'. My img tag does not have a height value set, so is that why it is returning 0? If so, how do I retrieve the value of the height of the image ? Also, I noticed that when I do an animate to increase the size of the...

How to Validate a readonly="readonly" situation

Hi, In javascript, how can I check to see if an item, say "emailAddrs" that is set as readonly="readonly" has a value as I need to perform validation for situations like this before the form is submitted? Thanks ...

What is the meaning of {0} in JavaScript

In the code from this answer: $.validator.addMethod('lessThanEqual', function(value, element, param) { return this.optional(element) || parseInt(value) <= parseInt($(param).val()); }, "The value {0} must be less than {1}"); What is the meaning of {0} and {1}? What is the rule of thumb in Javascript to define those parameter replac...

How do I use a variable in the animate() function in jQuery?

I have been able to store the height for my image in a variable: var origh4 = $('img:eq(3)').height(); However, now I would like to use that variable in the animate function like so: $('img:first').fadeIn('normal').delay(500).animate({'height':'-=20%'}, 1500, 'easeOutQuad'); How do I do that? I would like to replace the '-=20%' w...

Modify childeren in an array.

Now I currently have an array that contains 120 pairs. For example: [[1, 12], [2, 15], [3, 10]] Essentially 120 long. Now I am using this data in a Jquery Flot graph. "I have a live example on jsFiddle here" Code: var numbers = []; var jsonString = ""; var PlotData; var x = 0; function EveryOneSec() { if (numbers.length == 120)...

hide column (header and rows) post jqGrid render

Is it possible to hide a specific column in jqGrid after it has been setup, while ensuring all alignments are correct (table width and header/data alignment) for IE/FF. The data can't be removed at back-end w/o major refactoring. I am reiterating through a specific column and checking if it is all empty, and if so, I tried .remove() on...

read the name of the optional arguments of a function

I have a bunch of functions (methods of a class actually) and I'm writing a method that will record the interactions with other methods in an array. so for example : foo = Base.extend ({ a : function (a1,a2){ .... }, b:function(b1,b2){ ... }, history : function(){ ... } }) to simpli...

Cannot add custom web part to page using the JS OM

I'm trying to add a custom web part (that is one I have written myself) using the new Javascipt OM available with SharePoint 2010. My solution is also running within the Sandbox. I have it working correctly for the Content Editor Web Part (based on sample code), however when I replace the Content Editor Web Part definition with one for ...

Javascript Arrays - Checking two arrays of objects for same contents, ignoring order

I have two JavaScript arrays (A and B) that contain objects that I created. I want to check that all the objects in array A are contained in array B, but not necessarily in the same order. What is the best way to do this? Edit: They are all actual objects, not primitives, so I will need to compare their contents and structure as well ...

The inheritance of javascript

Maybe this question is easy,but I can't understand now. String.prototype.self=function() { return this; } var s="s"; alert("s".self()=="s".self()) //false; alert(s.self()==s.self()) //false; If you know the reason, please tell me why the result is "false". ...

How do you set a selected item in an HTML dropdown by name, not by value?

I have an HTML combobox which contains unique options. For example, a country dropdown which contains country_id as a value and country name as text. Is there any way using jQuery or JavaScript to let me set the selected item using the country name not the country_id? ...

Why use the command pattern in GWT (or any web app)?

According to this video here Google is recommending the use of the command pattern on top of its request handling API. There is also a helpful looking project gwt-dispatch that implements that pattern. According to gwt-dispatch documentation I need to create four classes for each command: an action (e.g. command) a result (e.g. respo...

How to sign a java script

Hi guys, I am doing a signed applet , applet works fine without javascript. but when called from javascript it is not working . i came to know that if we have to call a signed applet thorough java script , script should be signed. How to sign a script without using netscape signtool . as signtool is not available now i think , hope i ...

Writing a webapp for creating presentations

I need to write a webapp similar to Google Presentations, but with lot fewer features (single slide; no effects, just editing styled text; images and shapes), for a specific requirement. I am undecided whether to do it in HTML/JavaScript or in Silverlight. I rate my skills as: C# - Advanced HTML/JavaScript - Intermediate Silverlight ...

Multiple User Control On Same Page And reference issue with Javascript

Hi, I have one usercontrol which contain one textbox, few buttons and one calander. I had place two instance of user control in one page as design time. It works fine all working from server side...mean server side events reference proper control at runtime. Problem start after raising server side events from javascript. I succeed to f...

Problem with Javascript Date function in IE 7, returns NaN

I have a twitter feed and I create a new date obj so I can format the date to my liking. var created = new Date(this.created_at) works in firefox and chrome but not in IE7. I seem to be having trouble passing the date through the new Date() function. It just returns undefined and NaN. Here is the code. If you try to test it out don't ...

Can do procedural PHP, want to do JavaScript, need to do OOP PHP first?

Here's a bit of a twist on the old which do I learn first question you've read a million times before... I began learning PHP last fall and feel I have become fairly competent in procedural PHP programming. As my site - the driving reason for these studies - has developed I've reached a point where learning OOP PHP would make for clean...