javascript

Javascript event that fires without user interaction?

A textbox on my form may change depending on what's selected in various drop down lists. Is there a way to call a javascript function when the textbox value changes? Tried onchange event but this only seems to work if a user manually changes the textbox value. Cheers, Breandán ...

How to convince my fellow .NET developers that learning jQuery will be beneficial

I have a few .NET developers who only want to use the MS AJAX Toolkit and think JavaScript (and any JS Library) is evil. I tried to explain that if you treat client-side development like a grown-up language you can build maintainable code ... but I assume that the classic ASP days have left a mark on these guys. Anyone have a suggestio...

Padding or margin value in pixels as integer using jQuery

jQuery has height() en width() functions that returns the height or width in pixels as integer... How can I get a padding or margin value of an element in pixels and as integer using jQuery? My first idea was to do the following: var padding = parseInt(jQuery("myId").css("padding-top")); But if padding is given in ems for example, ...

What's the best WYSIWYG editor when using the ASP.NET MVC Framework?

Hi, Was wondering what the best WYSIWYG editor that I can embed in a web-site based on the ASP.NET MVC Framework? Ideally it should be Xhtml compliant and allow users to embed images etc. The only one I've used before is the FCKEditor, how well does this work with the MVC - has anyone tried...? My main requirements are: Xhtml compli...

Why can't I connect to my COM objects events after creation?

I have written a COM object using C++. Creating the object and connecting to its events works fine if I do them both at the same time (Javascript): var obj = WScript.CreateObject("SomeCOMClass.Object", "event_"); However the following generates this error (msdn): http://msdn.microsoft.com/en-us/library/a7tya2wc(VS.85).aspx. var obj ...

Can I add a <br/> and links to a javascript alert?

I have the following statement: btnApply.Attributes.Add("onclick", "alert('Must be a member to Use this Tool')"); Is there a way to add a new line. I tried, but it showed the in the text. In addition, can I add a link that would close the alert and take the user to another page? How can I do this with my example? When I added the...

setTimeout and "this" in JavaScript

I have a method that uses setTimeOut property and makes a call to another method. On initial load method 2 works fine. However, after timeout, I get an error that says method2 is undefined. What am I doing wrong here? ex: test.prototype.method = function() { //method2 returns image based on the id passed this.method2('useSomeEl...

How do you suppress IE7 ActiveX messages using javascript?

I'm trying to decide whether to use a custom ASP.Net Ajax Extender or jQuery to perform a simple web service call. The web service method accepts a customer ID and returns the customer name. I'm leaning towards jQuery because of it's simplicity. The only problem is that due to my company's IE7 Group Policy settings, the first time jQu...

How might I send messages (strings) from a Win32 app to a Javascript program running in an existing IE window?

I have a system tray icon that receives incoming phone calls. When a call comes in, I want to send the phone number into a web app that does stuff on that phone number. We can launch the web app with the phone number in a query string, but if I launch a new window for every call, it will junk up the user's computer with lots of browser...

Correct way to reset or clear a Javascript object?

I have a Javascript class that contains a few functions and member objects: function MyUtils() { // Member Variables (Constructor) var x = GetComplexData(); var y = DoSomeInitialization(); // Objects this.ParamHash = function() { // Member variables this.length = 0; this.items = new Array(); // Constructor ...

How can I dynamically unload a javascript file?

I am including pages using Ajax but I also need to include their respective javascript files, which requires removing the previous javascript files from memory at the same time. How can I unload the currently-loaded javascript files (as well as their code in memory) so that I can load the new page's files? They will more than likely con...

triggering functions with facebook connect

I'm trying to do what is supposed to be fairly simple with facebook connect, but having no luck. When a user logs in, I want to show that users details (refreshed without reloading the page), and when the user logs out, I need to go back to a logged in state. The code I have is function update_user_box(){ jQuery('span#logge...

How can I get a Javascript stack trace when I throw an exception?

If I throw a Javascript exception myself (eg, throw "AArrggg"), how can I get the stack trace (in Firebug or otherwise)? Right now I just get the message. edit: As many people below have posted, it is possible to get a stack trace for a JavaScript exception but I want to get a stack trace for my exceptions. For example: function foo(...

Best way to query back unique attribute values in a javascript array of objects?

What would be the best (or fastest) way to find all the possible values of "foo" in the following example array. var table = [ {foo: 0, bar:"htns", stuff:123}, {foo: 2, bar:"snhn", stuff:156}, {foo: 5, bar:"trltw", stuff:45}, {foo: 5, bar:"lrctm", stuff:564}, //few thousand lines later {foo: 2596, bar:"cns", stuf...

How to determine Time On Site in Javascript?

Google Analytics tracks 'Time On Site'. How would you do that effectively? Does it actually track when the user closes the browser or navigates away? Thoughts? ...

iPhone Webkit jQuery strangeness: Can't update content

Running into the strangest problem on iPhone using jQuery with my WebViewController. I have a div into which I append content: <div id="thumbnails"> Here are your thumbnails: <div id="mythumbs"></div> </div> The code looks like: for (var i=0; i < thumbs.length; i++) { var item = thumbs[i]; $('<img class="imgthumb" />').dat...

How can I implement a gmail-style label chooser?

What's the easiest way to implement (something like) Gmail's interface for labeling messages? Does any javascript library have a widget like this? Behavior: Click a label in the dropdown to immediately label the message. Check multiple labels and then "Apply" to add multiple labels (not sure I like the "Apply" requirement...) Type i...

under what type to write javascript in html pages

What type should I use (If at all) in a javascript block inside html? application/x-javascript text/javascript something/other... ...

how to get rid of double-scrollbars on internal frame of GWT app

As part of porting a legacy application to GWT, we need to embed our existing JSPs inside of our GWT app. Many of these pages are quite long, resulting in a double scrollbar- one for window of the main app, and a second one for the content of the frame. I'd like to get rid of the internal scrollbar, and just have the normal browser scr...

Javascript interface with RS-232 Serial Port

I am currently working on a project that involves a 4 Port A/V switch. This switch can be controlled via RS-232. The computer that will interface with the switch runs Vista. I would like to create a sidebar gadget that has 4 buttons- 1 for each port on the switch. When the user presses the button, it switches to that port. I have ...