javascript

Functions as parameters (with parameters) -- JavaSript

If I have some OO javascript that looks like so: function someFunction(a, b, c) { // do something with a, b, and c } function theLoader() { loadFunction: someFunction, load: function() { // invoke the loadFunction with the proper parameter set } } var myLoader = new theLoader(); myLoader.load(); Let's assume that...

can client side Javascript detect when server has closed http connection while client is working?

In my application, the client is a Javascript set of functions in the browser, and it does some work - for example, playing a clip. It uses XmlHttpRequest to talk to the server. However, the server is allowed to abruptly close the connection since there is no other way it seems, to interrupt the client. Can the client detect, while it i...

Javascript popups, can I reference all js on the parent page like normal?

Hi, Are all popups the same when it comes to referencing the parent pages js variables/methods etc? How about ajax requests from within the popup's content? From what i understand a popup is just playing with the Z-order, so its basically still on the parents page just looks 'higher' right? ...

Hyperlink Rewriting with Javascript/Jquery

Here's what I"m trying to do. I have a hyperlink like this on my page: <a href="http://www.wikipedia.com/wiki/Whatever_Page_Here"&gt;Whatever Page Here</a> When a user clicks the link I want to grab that click. If it's a link I don't want them to click (like something that doesn't match the format http://www.wikipedia.com/wiki/xxxxx) ...

Launching a desktop application from a web site

Is it feasible to launch an application via a browser / URL? What are the options for doing this? I know the way to do it with IE and Windows (which usually doesn't work). Ideally, I would like this to be browser independent. Our application is RCP, so in theory Java Web Start could work, we would just have to do some significant chan...

Reddit style 'join' popup

Hi, Is reddit's join popup that appears on the page hidden on the page or is it injected via ajax? How do they do it? (general terms if someone out there knows, I will dig into the source myself but need some guru pointers). ...

Recommendation for JavaScript URL manipulation library / API

What are your recommendations for JavaScript URL manipulation library / API Specifically, I would like to Extract URL parameters out of a URL string. Ideally, would reflect into a JS object. Form URL parameter strings (ideally from a JS Object). ...

Anybody who have used Django and JQuery Autocomplete?

Is there anybody out there who have used Django and JQuery Autocomplete? Am stuck on this and i will highly appreciate to see how someone else has done this! especially without using the AutocompleteWidget! Gath ...

Javascript: onrefresh or onreload?

I want an event handler that fires when the user hits reload. Is onrefresh or onreload the correct handler to add to ? Also, will this even fire before or after onunload? Are there an browser inconsistencies? Thanks. ...

JScript 'import' syntax for ASP classic

I'm using an ASP "classic" server, with JavaScript as the language engine, specified by the directive: <%@LANGUAGE='JAVASCRIPT'%> I've noticed that `import' seems to be a keyword. Technical Information (for support personnel) * Error Type: Microsoft JScript compilation (0x800A03F2) Expected identifier /Default....

Pass JSON object to Web Method

I wanted to shared something I learned today with you all. My question was: Can you pass a JSON object from JavaScript code to a .NET Page Method? For example: var task = { Title: $("#titlenew input", $(newTaskRow)).val(), StartDate: $("#startnew input", $(newTaskRow)).val(), EndDate: $("#endnew input", $(newTaskRow))....

Is it better to hook up links to a JS function using ID's or "relative paths"?

You know the drill... say you have a list of links and corresponding divs. You want to show the div when the link is clicked -- so you want to get a reference to the div so you can hook an event up on the link. When you're setting up your events, is it better to hook things up using unique ids like: <a href="#" id="link123">Foo</a> ......

How to display browser specific HTML?

I'm trying to find a way to display one link to an IE user and another link to all other browsers using javascript or conditional comments (or whatever it takes). Basically... //pseudo code <!--[if IE]> <a href"ie-only.html">click here!</a> <!--[else]> <a href"all-other-browsers.html">click here!</a> <![endif]--> I don't thin...

How can I run a jQuery function using AS3

I am trying to run a jQuery function on my HTML page from AS3. This is my jQuery function: function loadImage(imageNumber) { imageURL = '<img src="images/image' + imageNumber + '.jpg">'; $("#imageBox").html(imageURL); } Here are the settings of my flash file in the HTML page: <param name="allowScriptAccess" value="always...

Why is JavaScript always broken up into separate <script> sections?

Duplicate of Any value in double script tags? Here's a code snipped from UserVoice in order to stick their tab on my site (this isn't specific to UserVoice however, I see this kind of thing all the time): <script type="text/javascript"> var uservoiceJsHost = ("https:" == document.location.protocol) ? "https://uservoice.com" : ...

Javascript variable evaluation in a map.

I'm attempting to pass some data via the jQuery's $.post() and I'm running into some problems with, what I can only classify as, variable evaluation in the data map. Lets get to it: var field = 'fooVar'; var value = 'barVar'; $.post('/path/to/url', { field:value, 'fooString':'barString' }); The end result is a POST with the following ...

storing hidden ids and then submitting them with ajax, best practices?

I have a list of messages with element ids as "message"+id ( message1, message2 etc) when user makes ajax request from any particular message i want to access only the id. should i strip the id from the message id in jquery before submitting or do it on the server side? Or is there a simpler way to represent the id on the webpage for eac...

Bookmarklet to perform multiple tasks

Hi everyone. I've been tinkering around this application all day long and have had a few difficulties. So basically the bookmarklet needs to allow the user to use a lot of functions from multiple JavaScript files, although all of the functions that the user will use are called from one file. Basically it includes all of the necessary fil...

Cancel slow-loading external scripts

I am dynamically adding script tags to the DOM so I can download JSON data. Occasionally something goes wrong with a download, and the script fails to load properly. How do I tell the browser to give up on a script that has taken too long to load? I think this is important because the browser limits the number of open requests at one ti...

Is ext js compatible with .jsp, java backend?

Is ext js compatible with .jsp, java backend? ...