javascript

Why is the legend in my Dojo charting chart not showing the colours?

I'm using dojo charting and for some reason the legend for my chart is showing x's instead of the colours. Here is my code: dojo.require("dojox.charting.Chart2D"); dojo.require("dojox.charting.themes.PlotKit.blue"); dojo.require("dojox.charting.widget.Legend"); dojo.require("dojox.layout.FloatingPane"); dojo.require("dojox.charting.the...

How to programmatically create a <script> tag and a script inside an ASP.NET page?

From time to time I run into situation in which I could solve a given problem by dynamicly creating piece of JavaScript, spesific to that instance of the page, that I could then insert in the final markup. Usualy this is because I want some behaviour to happen on the client side, rather than on the server side and creating a static JavaS...

How to fix this JQuery intellisense in Visual Studio 2008 problem?

How can i solve this problem "Error updating JScript IntelliSense: D:\myProject\js\jquery-1.3.2.js: Object doesn't support this property or method @ 2139:1", i did all in this Visual Studio jscript intellisense error with jQuery 1.2.6? But no hope, should i edit something in my Visual studio options, or Visual studio has a problem? ...

Which browsers have problems caching XMLHTTPRequest responses?

Do any of the currently popular browsers have particular problems caching* XMLHttpRequest responses that I need to be aware of? I'd like to be able to include XMLHttpRequest queries on every page as a method of dynamically loading content (ie JSON) or behaviour (like eval()ed Javascript) relevant to the type of page, but wanted to make ...

emacs javascript auto indentation

I'm looking for a way to turn off automatic indentation in emacs. I don't want emacs to automatically indent code when I enter special characters like ; or /* Thanks for any help. ...

"not well-formed" error in Firefox when loading JSON file with XMLHttpRequest

I'm getting a "not well-formed" error in the error console of Firefox 3.0.7 when the JavaScript on my page loads a text file containing an object in JavaScript Object Notation format. If the file contains nothing but the JSON object, it produces the error. If I wrap the object in <document></document> tags it does not produce the error. ...

Why are my javascript files not loading 'consistently' in IE7?

In what seems to be random occurrences, javascript files are not loading. I believe this diagnosis is correct because a) I have code to check, b) I've stepped through the code, and c) I get “'myfunction' is undefined” error when functions in those files are used. Sometimes this doesn’t happen for an hour, sometimes it happens every tim...

How to retrieve a value from <input> using jQuery?

I have to hidden input fields such as: <input name="foo" value="bar"> <input name="foo1" value="bar1"> I'd like to retrieve both of those values and POST them to the server using jQuery. How does one use the jQuery selector engine to grab those values? ...

yui or yui3

Is YUI3 ready mature enough? What are its advantages and disadvantes vs YUI ...

how to avoid nested switch?

I'm creating a contextual menu in javascript for a web app. The menu can appear in numerous contexts, and have different choices. I could have a different fuction for each context/choice: grid1_delete() grid1_duplicate() grid2_delete() grid2_add() grid2_duplicate() and hard code those in as the menu is being built. The thing I don't l...

How can I find out the download speed of the client from server?

According to the client's download speed I want to show the video's either in low or high quality. Any Javascript or C# solution is acceptable. Thanks. ...

Calling a flash external interface AS3 function on page load

I have a function defined in AS3 that's gonna be called from client side via JavaScript. The AS3 functions simply print some value on SWF screen when it's called. It works fine when I set an onclick event handler to a button and call the AS3 function. However I want to call this AS3 function as soon as the page loads. I am using jQuery ...

Keep webpage from scrolling to top on form submit.

I am submitting a form via an anchor tag and javascript. <a onclick="submit_form();">Submit</a> As soon as the button is clicked, the page immediately scrolls to the top of the page and continues the normal form submission process. How can I keep the page from scrolling to the top and why does it do that? ...

The ternary operator and if A, B, else C. Are there any important differences?

There are a few ways to do this in javascript. Foremost and most readable and flexible is probably: if (a){ //b } else { //c } Something else that only* works with assigning and is less readable is: var foo = 'c'; if (a){ foo = 'b'; } My main question, though, is about the last two methods I can think of: var foo = a ...

Copying a function object from one window to another

Is it possible to copy a function (or any object for that matter) from one window context to another in Javascript? Let's say I have a parent window with a frame in it. The frame defines a function foo(), which I'd like to copy to the outer window. (One reason to do it would be so that foo() is available when the frame document navigate...

Javascript: extending map objects

I don't know how to extend the map object with prototype and hope you can help. I have something like this: var map = {'one':1, 'two':2}; and I would like to have a method to check for the existence of a key: if (map.containsKey('one')){...} How would I extend the map object? ...

Automatic selection of <p></p>-text rendered in browser

Hello who would know of a possibility to automatically select Paragaph text as it gets rendered in a browser, preferably using JavaScript? In my case I have an amount of text in <p></p> tags and would like the page to appear with the text fully selected, just as if someone had done it manually with the mouse. Many thanks for your sugg...

saving / mirroring / crawling web pages that use javascript to generate content

I want to download web pages that use javascript to output the data. Wget can do everything else, but run javascript. Even something like:firefox -remote "saveURL(www.mozilla.org, myfile.html)" would be great (unfortunately that kind of command does not exist). ...

Can you put the JavaScript onload event anywhere besides in the body tag?

I'm familiar with the typical use of onload, as in the following: <body onload="alert('Hello, World!');"> ... </body> Is there anywhere else in a page that onload is valid? I can experiment to see if it will work in <script>...</script> tags, but it might save me some time if anyone knows all the places that it's valid to use onload....

Javascript and radio buttons. How do I get the vals?

Hello all, New to SO and javascript. I have been playing with JQuery for a couple of days now and I have a problem that I can't seem to solve. I have absolutely no js experience at all so if someone could help me out by literally spelling out what the issue is, I'd be gratful. I have a single group of radio buttons that will determine ...