javascript

In JavaScript is it possible to launch a file browser dialog programatically?

Instead of using the <input type="file"> tag I'd like to have a button that launches a file browser dialog. My first thought was to have a hidden file input tag and a button. I'd use the button click on the button to fire the onclick of the hidden file input, but I haven't been able to get this working properly. So the question is, is...

Is there any tools for automatic removal of comments from JavaScript code?

I'd like to have comments in my code, but I want them to be removed before deploying. Yes, it's not hard to write such a thing, but if it already exists… And how about comments in ASP pages? ...

checkbox in YUI DataTable

I'm using a column of checkboxes in a YUI DataTable, I works fine. But I haven't found a way to put a name and value attribute so I can use when the form is submitted. Thanks in advance. ...

Why am I seeing inconsistent JavaScript logic behavior looping with an alert() vs. without it?

I have code similar to this filtering entries in an Array of Objects: var filterRegex = new RegExp(".*blah.*","ig"); if (filterRegex.test(events[i].thing) && events[i].show) { console.log("SUCCESS: filtering thing " + i + " " + events[i].thing); events[i].show = false; numevents--; } I get inconsistent results with this if...

Setting HTML page vertical position with JavaScript

I have an HTML page that scrolls up and down (not a lot, but it does scroll). I'd like to set the scroll position in the page after executing some JavaScript. Can I do that? I'm using jQuery to inject some additional HTML at the bottom of the page and I'd like to programmatically scroll to the position of that new content after it's ad...

What is the accepted way to send 64-bit values over JSON?

Some of my data are 64-bit integers. I would like to send these to a JavaScript program running on a page. However, as far as I can tell, integers in most JavaScript implementations are 32-bit signed quantities. My two options seem to be: Send the values as strings Send the values as 64-bit floating point numbers Option (1) isn't p...

Giving a custom UserControl an ID in rendered HTML

When I use a ASP:Calendar control, and give it an ID: <asp:Calendar runat="server" ID="MyCal" /> It looks like this in the rendered html: <table id="NameMangled_MyCal"... /> And I can access the element by ID in javascript like this: var cal= document.getElementById("<%= MyCal.ClientID%>") However, When I make a custom user control...

How to Programmatically Inject JavaScript in PDF files?

How to Programmatically Inject JavaScript in PDF files? Can it be done without Adobe Professional? My goal is: I want to show up the print dialog immediately when I open the PDF. I know that this can be done with JavaScript code embedded in the document. ...

Why so many web pages contain such a strange code snippet in header?

I've noticed for quite a long time that strange domains such like jsev.com, cssxx.com appered in my firefox status bar from time to time, I always wonder why so many web pages contains resources from these strange domains. I googled it, but found nothing. I guess it's some kind of virus which infect the servers and insert the code. Here ...

Nice Labels with X in To Field of Compose Message?

In Facebook's Compose Message, each name that appears in the TO field uses a nice LABEL with an X. Click on the X, and you remove name from the To sender field. I see this same feature again in other web2.0 social networking apps. Are there open source tools that let me make those nice X LABELS after you click on the autocomplete list...

How do I stop FCKeditor reverting html entities back to their unicode characters

I am having a problem with FCKeditor reverting html entities entered in the source view back to their original unicode representations. For example when I enter &euro; into the source view, switch to html and then back to source view, the entity is replaced by an actual € symbol. The bigger problem, as a result, is that this unicode ch...

Help documenting Javascript in Visual Studio?

I'm trying to get my Javascript documentation in order so that my comments can be used by Intellisense), for example displayResults = function(msg, filterParams) { /// <summary> /// Gathers inputs and refreshes the grid and map /// </summary> /// <param name="msg">JSON data returned by GetConcessions ajax call</param> ...

Get All Elements in an HTML document with a specific CSS Class

What's the best way to get an array of all elements in an html document with a specific CSS class using javascript? No javascript frameworks like jQuery allowed here right now, and I could loop all the elements and check them manually myself. I'm hoping for something a little more elegant. ...

Countering the shady JavaScript IntelliSense support in Visual Studio 2008

With the release of Visual Studio 2008, Microsoft implemented code-completion and IntelliSense support for JavaScript. Unfortunately the support for JavaScript is shady at best--one of the major hassles being that when referencing external JavaScript files, the developer has to open and close JavaScript files to force Visual Studio to u...

In JavaScript can I make a "click" event fire programmatically for a file input element?

I'd like to make a click event fire on an <input type="file"> tag programmatically. Just calling click() doesn't seem to do anything or at least it doesn't pop up a file selection dialog. I've been experimenting with capturing events using listeners and redirecting the event, but I haven't been able to get that to actually perform the ...

What is the best way to center a div on the screen using jQuery?

The title says it all really. ...

Asp.Net: Javascript Modal Window

I would like to create a javascript modal pop up window to get some values from a user in a ASP.Net 2.0 webpage. The basic idea is this. When a user clicks a button, a modal window will come up and ask 3 or 4 questions. The asp.net page will not be able to be changed while this window is up. Once the questions have been answered I need ...

how to auto select an input field and the text in it on page load

Upon page load I want to move the cursor to a particular field. No problem. But I also need to select and highlight the default value that is placed in that text field. ...

How can I give control back (briefly) to the browser during intensive JavaScript processing?

I have read the post here about using setTimeout() during intensive DOM processing (using JavaScript), but how can I integrate this function with the below code? The below code works fine for a small number of options, but when the number of options gets too big my "please wait" animated GIF freezes while the local JavaScript is processi...

Access KML placemarks in a Google Maps overlay via Javascript?

I have a KML file overlay on an embedded Google Map using the GGeoXml object. I'd like to be able to access specific placemarks in the KML file from Javascript (for example to highlight a selected polygon on the map in response to user action). Ideally what I'd like to do is something like this (pseudo-code): geoXml.getPlacemarkByNam...