javascript

What's a good book to learn Javascript DOM manipulation?

I'm looking for a book I could use to learn the subject of DOM scripting. So far I just have been learning only the things I needed for my given projects online, but I would like to buy a book on the topic so I can fully learn the material as a whole. Any suggestions? ...

Why won't an Ajax Script Work Locally?

I've an issue with the same piece of code running fine on my live website but not on my local development server. I've an Ajax function that updates a div. The following code works on the live site: self.xmlHttpReq.open("POST", PageURL, true); self.xmlHttpReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); self.x...

What's the Meaning of and Fix for the Error 'The Controls Collection cannot...'

Using ASP.NET 2.0, I have a web app where I am trying to use Javascript to make one tab in a tabcontainer the active tab. The recommendations have been based on: var mX=document.getElementById('<%= tc1.ClientID%>') $find('<%= tc1.ClientID%>').set_activeTabIndex(1); Which both produce the error: The Controls collection cannot be mod...

Popup Window similar to Modal Window

I need to open a popup Window to a cross domain content. I should not allow the user either to access or close the parent window, till i am done with Child window. The main issue with Modal window is that stops any asynchrnous process running on the main window. For example, timers and auto refresh wont be working in the parent window....

Load external JS from bookmarklet?

How can I load an external Javascript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner. ...

Javascript with embedded ruby - How to make sure the string does not break?

I have this line in a javascript block in a page: res = foo('<%= @ruby_var %>'); What is the best way to handle the case where @ruby_var has a single-quote in it? Else it will break the js code. ...

Disable button on form submission

I have a button that I would like to disable when the form submits to prevent the user submitting multiple times. I have tried naively disabling the button with javascript onclick but then if a client side validation that fails the button remains disabled. How do I disable the button when the form successfully submits not just when the...

Javascript - Get Image height

I have to display a bunch of images all of which may be of different dimensions on a webpage using AJAX.I want to adjust their size before displaying them. Is there any way to do this in Javascript. Using PHP's getimagesize() for each image is unnecessary performance hit since there will be many images. ...

How do I get the value of a JSObject property from C?

In SpiderMonkey, how do I get the value of a property of a JSObject from within my C code? static JSBool JSD_getter(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { jsval js_id; JS_GetProperty(cx, obj, "id", // js_id has JavaScript type int c_id; JS_ValueToInt32(cx, js_id, // Now, c_id contains th...

Is JavaScript object-oriented?

There have been some questions about whether or not JavaScript is an object-oriented language. Even a statement, "just because a language has objects doesn't make it OO." Is JavaScript an object-oriented language? ...

XML based website - how to create?

I would like to create an xml based website. I want to use xml files as datasources since it is a kind of online directory site. Can someone please give me a starting point? Are there any good online resources that I can refer to? I am pretty confortable with ASP and Javascript. Thank you in advance. Best regards, Aravind ...

How would you implement auto-capitalization in JavaScript/HTML.

I need to implement auto-capitalization inside of a Telerik RadEditor control on an ASPX page as a user types. This can be an IE specific solution (IE6+). I currently capture every keystroke (down/up) as the user types to support a separate feature called "macros" that are essentially short keywords that expand into formatted text. i....

A Firefox javascript bookmarking problem

I'm using the following JavaScript code: <script language="JavaScript1.2" type="text/javascript"> function CreateBookmarkLink(title, url) { if (window.sidebar) { window.sidebar.addPanel(title, url,""); } else if( window.external ) { window.external.AddFavorite( url, title); } else if(window.opera && window.print) ...

How do I make an HTML text box show a hint when empty?

I want the search box on my web page to display the word "Search" in gray italics. When the box receives focus, it should look just like an empty text box. If there is already text in it, it should display the text normally (black, non-italics). This will help me avoid clutter by removing the label. BTW, this is an on-page AJAX search, ...

GWT or DOJO or something else?

I come from the Microsoft world (and I come in peace). I want to rapidly prototype a web app and if it works out, take it live - and I don't want to use ASP.Net. I am not sure which web application toolkit to use though. Should I use GWT, DOJO...other recommendations? I am open to any server-side language but am looking at RoR, Php or ...

Relative urls for Javascript files

I have some code in a javascript file that needs to send queries back to the server. The question is, how do I find the url for the script that I am in, so I can build a proper request url for ajax. Ie. the same script is included on /, /help /whatever and so on, while it will always need to request from /data.json. Additionally, the sa...

Countdown timer on ASP.NET page

Could you recommend me a way to place a coundown timer on ASP.NET page? Now I use this code: Default.aspx <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server">60</asp:Label> <asp:Timer ID="Timer1" r...

Stop setInterval call in javascript

I am using setInterval(fname, 10000); to call a function every 10 secs in javascript. Is it possible to stop calling the calling on some event? I want the user to be able to stop the repeated refresh of data. ...

Can you do Desktop Development using JavaScript?

I know there's JScript.NET, but it isn't the same as the JavaScript we know from the web. Does anyone know if there are any JavaScript based platforms/compilers for desktop development? Most specifically Windows desktop development. ...

Defining objects when using Jaxer

I've been playing with Jaxer and while the concept is very cool I cannot figure out how to define objects that are available on both the client and the server. None of the examples I can find define objects at all. I'd like to be able to define an object and specify which methods will be available on the server, which will be available ...