javascript

Compress Script Resources of ASP.Net

How do you compress Script Resources of ASP.Net? I saw a file there reached up to 255 KB! I tried finding solutions, but so far it only talks about scripting dynamic and static files. I checked the compression temp folder of IIS and found no compressed scripted resource there. That led me to the conclusion that these files are transferre...

How can I determine if a JavaScript variable is defined in a page?

How can i check in JavaScript if a variable is defined in a page? Suppose I want to check if a variable named "x" is defined in a page, if I do if(x != null), it gives me an error. ...

When should I use Inline vs. External Javascript?

I would like to know when I should include external scripts or write them inline with the html code, in terms of performance and ease of maintenance. What is the general practice for this? Real-world-scenario - I have several html pages that need client-side form validation. For this I use a jQuery plugin that I include on all these pa...

Javascript Iframe innerHTML

Does anyone know how to get the HTML out of an IFRAME I have tried several different ways: document.getElementById('iframe01').contentDocument.body.innerHTML document.frames['iframe01'].document.body.innerHTML document.getElementById('iframe01').contentWindow.document.body.innerHTML etc ...

What'a Good Way to Organize External Javascript File(s)

In an ASP.NET web app with a lot of HTML pages, a lot of inline Javascript functions are accumulating. What is a good plan for organizing them into external files? Most of the functions are particular to the page for which they are written, but a few are relevant to the entire application. A single file could get quite large. With ...

What is the best way to prevent highlighting of text when clicking on its containing div in javascript?

I am building a menu in HTML/CSS/JS and I need a way to prevent the text in the menu from being highlighted when double-clicked on. I need a way to pass the id's of several divs into a function and have highlighting turned off within them. So when the user accidentally (or on purpose) double clicks on the menu, the menu shows its sub-e...

Delayed jump

How do I cause the page to make the user jump to a new web page after X seconds. If possible I'd like to use HTML but a niggly feeling tells me it'll have to be Javascript. So far I have the following but it has no time delay <body onload="document.location='newPage.html'"> ...

Which Javascript Framework is the simplest and most powerful?

I've been using various javascript frameworks including mootools, jquery, prototype and scriptaculous and have found them all good, but difficult to extend to more complex ideas. If I am going to knuckle down and learn one, which is the simplest to extend and use whilst staying powerful enough to use in a variety of directions? ...

How to submit form with data before logging someone out?

Hello, I'm using the document.form.submit() function for a rather large input form (hundreds of fields, it's an inventory application). I'm calling this after the user has been idle for a certain amount of time and I would like to save any data they've typed. When I try this the page reloads (the action is #) but any new text typed in ...

ASP.NET Validation Controls and Javascript Confirm boxes

I have a page using .NETs server-side input validation controls. This page also has a javascript confirm box that fires when the form is submitted. Currently when the Submit button is selected, the javascript confirm box appears, and once confirmed the ASP.NET server-side validation controls are fired. I would like to fire the server-...

How would I raise an event (jQuery or standalone Javascript) when a popup window is closed?

I want to raise an event when a popup window is closed, or preferably, just before closing. I'm storing the popup window object as an object, but I don't know of any way to bind to the close event, or an event just before the window is closed. var popupWindow = window.open("/popup.aspx", "popupWindow", "height=550,width=780"); Is ther...

Will the Javascript performance improvements from Trace Trees find their way into other interpreted languages?

It sounds like Mozilla is having good luck improving JavaScript performance with TraceMonkey. See also Andreas Gal's paper on Trace Trees. Are these improvements available to other interpreters/compilers and if so, does this mean we'll see a cascade of improvements in other interpreted languages? ...

Client/JS Framework for "Unsaved Data" Protection?

Hey all- we have a typical web application that is essentially a data entry application with lots of screens some of which have some degree of complexity. We need to provide that standard capability on making sure if the user forgets to click the "Save" button before navigating away or closing their browser they get a warning and can ca...

Testing for multiple screens with javascript

Is it possible to tell if the user of a website is using multiple monitors? I need to find the position of a popup but it's quite likely the user will have a multiple monitor setup. Whilst window.screenX etc. will give the position of the browser window it's useless for multiple monitors. ...

Firebug - how can I run multiline scripts or create a new JavaScript file?

Is there a way in Firebug to start a new script file to apply to page? Basically I want to do work like I'd normally do on the Firebug console but be able to to paste in multi-line functions, etc. It doesn't seem like the console is amenable to that. ...

In BIRT, how do I access an arbitrary data set from JavaScript?

I am building my first report in BIRT. Very quickly I ran into a problem in which I wanted to display some text or data based on an expression that included data from two different tables (not tables that can/should be joined - (hypothetically example- take a student's ACT score from his record in the student table and compare it agains...

Javascript error: [elementname] has no properties

I'm doing some maintenance coding on a webapp and I am getting a javascript error of the form: "[elementname] has no properties" Part of the code is being generated on the fly with an AJAX call that changes innerHTML for part of the page, after this is finished I need to copy a piece of data from a hidden input field to a visible input ...

Calculate timespan in JavaScript

I have a .net 2.0 ascx control with a start time and end time textboxes. The data is as follows: txtStart.Text = 09/19/2008 07:00:00 txtEnd.Text = 09/19/2008 05:00:00 I would like to calculate the total time (hours and minutes) in JavaScript then display it in a textbox on the page. ...

How do I detect a keyboard modifier in a bookmarklet?

Is there a way to detect if the user is holding down the shift key (or other modifier keys) when executing a javascript bookmarklet? In my tests of Safari 3.1 and Firefox 3, window.event is always undefined. ...

How do you pass parameters to called function using ASP.Net Ajax $addHandler

I am trying to use the $addHandler function to add a handler to a text box's click event var o=$get('myTextBox'); var f = Type.parse('funcWithArgs'); $addHandler(o, 'click', f); However I need to pass parameters to the called function. How do you do that? TIA ...