javascript

Speeding up FCKEditor

Does anyone have a technique for speeding up the FCKEditor? Are there some key JavaScript files that can be minified or removed? ...

Any examples of a non-trivial and useful example of the 'with' keyword?

I still find the with keyword a bit...enigmatic. Briefly, with behaves like this: with (obj) { // do stuff } This adds obj to the head of the scope chain and then executes the with-block. When the block is finished it removes obj from the head of the scope chain. According to MDC, this allows you to do stuff like var a, x; ...

Trouble with changing the backgroundImage property

Hi, I have an element on a page with background image set using css: // CSS snippet .mystyle { background-image: url(some_image.gif); // and other styles like width, height, padding, text-align, etc. } // HTML snippet <input type="button" name="mybutton" id="b1" class="mystyle" onclick=" some_function();" value="Apply"> In a...

<input type='file'> IE Gives full path, FF gives only filename (or directory browse)

Possible Duplicate: Cant get the complete address while uploading a file I need the full path. I'm trying to give the functionality of local bookmarks, ie user wants to access c:\MyStuff\Myfile.xls on their local Pc. How do I save/get that value without having to make a tutorial help page on how to cut and paste c:\MyStuff\Myfil...

JavaScript: Very strange behavior with assigning methods in a loop

Consider this code below: <a href="javascript:void(-1)" id="a1">a1</a> <a href="javascript:void(-1)" id="a2">a2</a> <script type="text/javascript"> var buttons = [] buttons.push("a1") buttons.push("a2") var actions = [] for (var i in buttons) { actions[buttons[i]] = function() { alert(i) } } var el...

What is the easiest, most reputable, most seasoned AJAX framework?

I have dabbled with various AJAX frameworks, namely GWT, Dojo, Ext-JS, jQuery UI. I am interested in understanding what AJAX frameworks best meet the following criteria: - Most easy to learn - Most painless to keep maintained - Most reputable, stable, founded & grounded - Easiest to read and share - Integrates well with J2EE ...

Collecting form data and removing or hiding a form field using JQuery

Hello , I'm currently working on a problem that basically involves processing all data in a form, saving it, and replacing the entire form with a text link. My primary goal is to convert a form, with some data using the POST method, and a submit button, into a standard text link that can then take the saved/serialized data and POST it t...

Passing an HTML string to jQuery function

I'm working on an application which retrieves some HTML code from a record in a database. That strings then gets taken and inserted inside of a specific div. Right now I'm accomplishing this by passing the variable from Java and printing it within the div in the JSP. Now I'm trying to use an external jQuery function to accomplish this ta...

Finding control

The following does not work: var EtxtDOB = $get('<%=FormView1.FindControl("frmEditPerson").FindControl("EtxtDOB").ClientID %>'); How can I find this nested control in javascript? ...

JavaScript variable binding and loop.

Consider such loop: for(var it = 0; it < 2; it++) { setTimeout(function() { alert(it); }, 1); } The output is: => 2 => 2 I would like it to be: 0, 1. I see two ways to fix it: Solution # 1. This one based on the fact that we can pass data to setTimeout. for(var it = 0; it < 2; it++) { setTimeout(function(data...

How to make a Google Maps API (.js) file a part of a widget for Mobiles

Hello There. I would like to create a Web App for device. For that I would have some script being stored on device, instead of downloading them all time when I start application. As far as I saw including a GoogleMaps API makes some additional request for javascript files. Is there any way of having all of them taken directly from local...

Is it an anti-pattern to modify JavaScript's built-in prototypes?

I understand from this post, that it's an anti-pattern to modify Object's prototype in JavaScript. I was curious, however, if it's widely considered to be an antipattern to modify other 'built-in' prototypes. For example: say we wanted to add a setPixel(x,y,color) function to CanvasRenderingContext2D - to abstract out the duty of get...

Call a JavaScript function from a texbox that is generated by an MVC Helper.

How do I call a JavaScript function from a texbox that is generated by an MVC Helper. I want my textbox to call a function like this: <input type="text" id="Ejemplo" onkeyup="SumaEjemplo()" /> I'm using: <%= Html.TextBox("Ejemplo")%> Where do I put it? ...

Pass Javascript Alert a Value

I'm looking for a simple javascscript alert box. I need to be able to pass the alert box a string of text. Is something like this possible? My syntax is probably wrong. <html> <head> <script type="text/javascript"> function show_alert() { alert(my_string_here); } </script> </head> <body> <input type="button" onclick="show_alert()" va...

Executing a function by name, passing an object as a parameter

Hi, Here's the problem - I know function by name (and that function has already been loaded form an external script), but I don't have an actual function object avail for me to call. Normally I would call eval(function_name + "(arg1, arg2)"), but in my case I need to pass an object to it, not a string. Simple example: var div = docume...

How would I stagger text around an uneven background image?

Often as a Web Producer I get a lovely mock-up with text wrapping around an obvious background image. The content is going to come from a backend CMS and I don't want the editorial staff to worry about inserting <br /> tags etc. Lorem ipsum dolor sit amet, consectetuer adiping elit, xxxxxxxxxxxxxx sed diam nonummy nibh euismod tin...

jQuery: Using Selectors on HTML from an Attribute

Hi, I have some HTML that is stored as an attribute on a tag. I can access it in jQuery using $("input[id$='_myField_hiddenSpanData']").attr("value") This looks like this: "<span id='spantest\user' tabindex='-1' contentEditable='false' class='ms-entity-resolved' title='test\user'><div style='display:none;' id='divEntityData' key='t...

how to encrypt string data so that it can only be decoded by the computer it resides on ?

say i have strings that are sent back and forth from the client, and server via AJAX. however i wish to securely encrypt it before being sent via the client. once it's on the server, it should be decrypted, and processed. additionally, how does password encrypting work ? user signs up, and upon entering password, its encrypted on the s...

Making HTML Table sortable and selectable

I have a very specific requirement for a Prototype based JS / HTML script (or something that doesn't interfere with Prototype) that can add the following functionality to a normal, multi-column HTML table: Re-order rows using drag and drop and send changes to a Javascript handler function (not a "sortable table" function to order by fi...

Manipulating Javascript's parenthesized substring matches

Example taken from Mozilla's help page <script type="text/javascript"> re = /(\w+)\s(\w+)/; str = "John Smith"; newstr = str.replace(re, "$2, $1"); document.write(newstr); </script> Is it possible to further manipulate the substring match directly in any way? Is there any way to, for example, capitalize just the word Smith in ...