javascript

Long-lived connections (asynchronous server push) with Apache/PHP/Javascript?

I come from more of a Java background. In the last year or two, it's become somewhat popular to do server push over HTTP using long-lived HTTP connections in Comet. It's an extremely useful technique. So I'm curious what the equivalent is with Apache + PHP + Javascript? One option I see is just using straight AJAX calls (eg with jQue...

Open the Save Image dialog using jQuery/Javascript?

When a user clicks on an image on a web page, I'd like to trigger the browser's Save Image dialog and to let the user save the image on their hard drive. Is there a cross-browser way to do this with jQuery/Javascript? ...

DHTML: Get updated element size

I'm updating the src attribute of an <img> tag in javascript. After I've done this, I need to get the new height of its parent <div> so that I can update the size of other elements on the page. If I retrieve the parent's offsetHeight property directly after updating the image's src, however, I get the height before the change was made....

How do you attach to events on a ScriptObject in Silverlight?

The HtmlObject provides all the necessary functionality to register managed event handlers for script and DOM events, but what if the class you need to listen to doesn't exist as a DOM element, but a scripting variable (referenced via ScriptObject) instead? ...

AJAX Page Download progress

I want to get the progress of my AJAX request - how much has been downloaded so far out of how much the file is. For example, I am downloading a large picture with AJAX so I can put the content in a DATA url (this may not be the best way to do that, it's just a example.) So, I make the AJAX request to some host I have no control over (...

Web page -user custom style

How can I give the user the ability to change the style of a webpage, of course I have to make several CSS files , but how can I make the code that permits the change upon the user's choice ...

IE browser problems occurring with Javascript Movable Type SignIn widget!

i am using movable type 4.23 (publishing system) and have been testing my site on a PC and discovered that internet explorer (IE) browsers are unable to view my site due to a conflict in the javascript of the signin widget (initially i thought it was in the mt.js file). i receive this error: "Error 80004004"...as well as in the Javascri...

Google Maps API: Access markers after creation

I'm wondering if there is a way to access the Markers that were added to a Map using JavaScript after creation. I mean, is it possible to make a button somewhere on the page that, on each click, centers the map on another marker that was added previously? Any help would really be appreciated! ...

Downscaled versions of jQuery or Prototype - JS framework selection

While considering the JS framework for my next project, I can see the scale clearly tipping towards jQuery, however, Prototype is getting good reviews, too. The issue I am thinking of is how to downscale these to have only the functionality I REALLY need. The latest jQuery seems to be 55k compressed, for instance, and I clearly need onl...

IE closing just opened popup window

I have a ASP.NET button on a page that opens a popup window this way: String cstext1 = "window.open('ReportViewer.aspx');"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), cstext1, true); The ReportViewer.aspx file gets some data, passes it to crystal reports and streams the PDF output ...

How to handle programmatic change of the input element state in javascript

Hello, I've faced strange problem. While user change of check box input element on form produces adequate event programmatic change don't. How should I face this challenge? Code following: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/...

How to Copy to Clipboard in JavaScript?

What is the best way to copy text to the clipboard? (multi-browser) I have tried: function copyToClipboard(text) { if (window.clipboardData) // IE { window.clipboardData.setData("Text", text); } else { unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); ...

Disable ASP.NET validators with JavaScript

Does anyone know how to disable an ASP.NET validator using JavaScript? I'm using javascript style.display = 'none' to disable parts of a web page. However these disabled parts have asp.net validators that are still firing and I need to disable then without doing a round trip to the server. Thanks. ...

ASP.Net ScriptControl - Add the Javascript get_events method : Possible?

So I've run into a snag, apparently the get_events method is only "included" with the ExtenderControl class. What I need to do: Be able to call the get_events Javascript method using a ScriptControl since using an ExtenderControl isn't really possible at this point. I am hoping there is an easy way to have the scriptControl's javascri...

Why doesn't my form post when I disable the submit button to prevent double clicking?

Like every other web developer on the planet, I have an issue with users double clicking the submit button on my forms. My understanding is that the conventional way to handle this issue, is to disable the button immediately after the first click, however when I do this, it doesn't post. I did do some research on this, god knows there'...

ASP.NET - Disabling validators in a gridview using javascript

Further to my question on disabling validators using javascript - http://stackoverflow.com/questions/400346/disable-asp-net-validators-with-javascript ... Does anyone know how to pass through a gridview in javascript to dynamically disable the validators on each row. I now understand that I'll need to use ValidatorEnable(validatorContro...

Get CRM Popups to Refresh Opening Window

I am loading a Microsoft CRM 4.0 window from an Intranet page using window.open(...). When the window closes, I need it to programmatically press a button on the page that opened it. I can do this from my own form by getting the button (whose name is passed in the querystring) and executing its click method in JavaScript. I thought I c...

Javascript (jQuery) performance measurement and best practices (not load time)

I'll say right off the bat that this question is NOT about load times; I know about YSlow, the Firebug profiler, and whatever best practices and tools googlage reveals about page component load times. I am asking what good profiling tools or libraries or add-ons there are for measuring actual execution of Javascript (specifically jQuery...

ASP.Net ScriptControl - Call one method from another

Say I have two script controls and one control has the other as a child control: ParentControl : ScriptControl { ChildControl childControl; } The script for the Child Control: ChildControl = function(element) { ChildControl.initializeBase(this, [element]); } ChildControl.prototype = { callMethod: function() { ret...

How to Best Perform Client-Side Validation Against Moderate Size Array

Overview: I have an array of 20 byte strings that needs to be stored on a web page for use in user entry validation. I anticipate between 25 and 1000 elements in that array. Considerations: 1. The web client will be a mobile device with reduced memory and processor capability. 2. I am limited to client-side validation only (technical l...