javascript

jQuery/JavaScript - performance-issue when having a lot of small .js-Files?

Hi all, i've got a site with a lot of referenced .js-Files; those are rather small files, but I want to keep my methods separated by topic/functionality. Is it better to keep all the methods in one .js-File or is it no problem to have many (~ 20 - 30) small files all including only some lines? ...

Javascript: how do I determine if a link targets the same domain as the page it resides on?

For the purposes of tracking non-HTML documents via google analytics, I need the mentioned algorithm. It should: not hard-code the domain ignore the protocol (i.e. http/https) not worry about the presence/absence of "www" (any absolute links WILL prefix with "www" and all pages WILL be served via "www") This is complicated by the fact ...

ASP.NET linkbutton raising onBeforeUnload event twice

I've posted this here, but thought it might deserve a question on its own. What I'm trying to do is show a dialog box that asks the user if he/she wants to leave the page if there are unsaved changes. That all works fine. But the problem is described below: Has anyone come across the problem where Internet Explorer fires the onbeforeun...

javascript in masterpages ASP.NET 2.0

Hi all, I am trying to set up a masterpage that contains a javascript popup subroutine that can be used in multiple web pages. The popup already works in a single page environment. I now want to migrate it to a master page. Any ideas will be greatly appreciated. I already searched this site and tried a couple of the suggestions to no ava...

How to resize a container div to the total height of its children?

I have a container element which I need to resize as its contents change. It contains 2 absolutely positioned divs which can both change height. If I don't specify the height of the container then anything after the container disappears under the contents. At the moment I am doing the following but I'd be pleased to find a less laborio...

Javascript access to spell checker on browsers

Is it possible to get access to the spell checker that is incorporated in browsers for text areas from Javascript? I would like to be able to control spell checking from withing my code. Most browsers (apart from IE) seem to have some kind of a spell checker built in to them nowadays. ...

Javascript on scroll to end

Sometimes software installers force you to scroll to the end of the EULA before the “I agree” box is enabled. How can I produce the same effect on a web page? ...

How do I set the margin of an object with javascript?

I am trying to set the margin of an object from JavaScript. I am able to do it in Opera & Firefox, but the code doesn't work in Internet Explorer. Here is the JavaScript I have: function SetTopMargin (ObjectID, Value) { document.getElementById(ObjectID).style.marginTop = Value.toString() + "px"; } And it is called like this: Se...

Best way to manage costly scrolling in JavaScript?

We have a UI widget on our main UI that uses JavaScript to respond to scrolling events from the browser. The response to each scroll event is relatively expensive. A user can easily "queue" up a large set of scrolling events, while the first several are being processed and rendering within the widget. The problem with this is that then ...

What's the most bullet-proof way to upload large files in a web app?

We have to accept large file uploads (video content) and want to do that in a way that works well across all standards-compliant browsers and plug-ins. Our current setup looks like this: SWFUpload input type="file" for graceful degradation On the server-side, we have nginx and the upload module streaming the uploaded files into the s...

File structure for javascript-based web application

I'm planning to write a javascript-based web application. I'm wondering what the best way to implement it in terms of file stucture is. There is one main page (main.html) containing a menu and a main div section. The way it works is simple: When the user clicks on one of the links in the menu (for example 'Page 1'), the content of the d...

Moving a DOM element containing a dynamically created script tag

I'm using the Fish Gadget (http://abowman.com/google-modules/fish/) within a wiki based CMS, and need to reposition the gadget from one HTML element to another. (Note: the fish gadget is an example -- the problem occurs with other gadgets as well.) If I directly reposition the gadget using the gadgets base class "ig_reset", then everyth...

Actionscript 3 REPL

Is there a REPL (Read-Eval-Print Loop) available anywhere for Actionscript 3? I could not find anything on google, but it would really come in handy. ...

Get real image width and height with Javascript in Safari/Chrome?

I am creating a jQuery plugin. How do I get real image width and height with Javascript in Safari? Following works with Firefox 3, IE7 and Opera 9: var pic = $("img") // need to remove these in of case img-element has set width and height pic.removeAttr("width"); pic.removeAttr("height"); var pic_real_width = pic.width(); var pic_r...

SAJAX and Form fields

Is there a way to send a whole form's fields through a sajax function call? I think it is sajax anyway. We are using Mediawiki and the function call is to "sajax_do_call(funcName,[params],callbackFuncName)" I was just wondering if there was a way to jsut drop all fields from a form into params? ...

Get encoding of page/iframe via JavaScript

I'd like to programatically determine the encoding of a page via JavaScript, or some other API from a browser. The reason I want this information is because I am attempting to fuzz major browsers on what character encodings they support, and obviously just because I sent the appropriate "Content-Type" doesn't mean that the browser will d...

Cross domain Ajax request from within js file.

Here's the problem: 1.) We have page here... www.blah.com/mypage.html 2.) That page requests a js file www.foo.com like this... <script type="text/javascript" src="http://www.foo.com/jsfile.js" /> 3.) "jsfile.js" uses Prototype to make an Ajax request back to www.foo.com. 4.) The ajax request calls www.foo.com/blah.html. The callba...

Trouble encoding a u umlaut with in a .Net http handler

I have a JavaScript request going to a ASP.Net (2.0) HTTP handler which passes the request to a java web service. In this system special characters, such as those with an accent do not get passed on correctly. E.G. Human input: Düsseldorf becomes a JavaScript asynch request to http://site/serviceproxy.ashx?q=D%FCsseldorf, which is val...

Script.aculo.us Sortable onUpdate problem in IE.

I'm working on a project where I am using a script.aculo.us Sortable object. It works nice and fast in Firefox and Chrome, but in IE it is incredibly slow whenever I drop an element. I've done a little checking, and it turns out that in IE, the "onUpdate" callback function gets called about 8 times every time I drop. Normally it is s...

Make virtual earth infobox appear on click instead of hover?

Is it possible to make Virtual Earth pushpin infobox display respond from onclick instead of mouseover? Currently I'm using something like this: ... var pin = new VEShape( VEShapeType.Pushpin, [location] ); pin.SetCustomIcon(icon_url); pin.SetTitle(title); pin.SetDescription...