javascript

Should I include type="text/javascript" in my SCRIPT tags?

I read through Crockford's JavaScript best practise, and he stated: There is no need to use the language or type attributes. It is the server, not the script tag, that determines the MIME type. But I've never seen anyone omit the type attribute in their <script> tag... Do you guys include type? Why (not)? ...

Max parallel http connections in a browser?

Hi, I am creating some suspended connections to an http server (comet, reverse ajax, etc). It works ok, but I see the browser only allows two suspended connections to a given domain simultaneously. So if a user is looking at my web app in Tab1 of their browser, then also tries loading it in Tab2, they've used up the two allowed connecti...

How to create a DIV style switcher in JavaScript?

I want to make a CSS style switcher in JavaScript, same as digg.com does here: http://digg.com/add-digg I am having a div, in which I want to change the style of the div box on the basis of theme selection. Please give me any link or code, how I can do this. I don't want to use Jquery, I want to develop this cod ein pure javascript. T...

Will setInterval drift?

Hi This is a pretty simple question really. If I use setInterval(something, 1000), can I be completely sure that after, say, 31 days it will have triggered "something" exactly 60*60*24*31 times? Or is there any risk for so called drifting? ...

IE and unspecified error and in IE8 object doesn't support method

I have a big (probably) javascript problem. i have a long and complex script on the page based on mootools framework, in FF and other browser everything works fine, but in ie 6 and 7 i got "error:153 (sometimes 84) Unspecified error" and the strange thing is in IE8 that show me the error "Object doesn't support this property or method"....

JavaScript Detection / Browser Statistics

This has been asked few times but I think it's still worth checking with you guys for some more input. All my websites use Google Analytics for stats. Since it relies on JavaScript I thought it was important for me to check how many people actually have JS enabled in their browsers enabled/disabled. I remember I usually checked w3schoo...

Jquery XML parsing

I have an xml like this <resultGroups> <subGroups> <results> </results> <results> </results> </subGroups> <subGroups> <results> </results> <results> </results> </subGroups> <name> </name> </resultGroups> <resultGroups> <subGroups> <results> </results> <results...

XML parsing with Jquery

<resultGroups> <subGroups> <results> </results> <name></name> </subGroups> <subGroups> <results> </results> <name></name> </subGroups> <name>myname</name> </resultGroups> <resultGroups> <subGroups> <results> </results> <results> </results> <name></name>...

How to get select radiobutton value using its name in jQuery?

I am having 4 radiobuttons in my web page like below: <label for="theme-grey"><input type="radio" id="theme-grey" name="theme" value="grey" />Grey</label> <label for="theme-grey"><input type="radio" id="theme-grey" name="theme" value="pink" />Pink</label> <label for="theme-grey"><input type="radio" id="theme-grey" name="theme" value="gr...

Height of invisible objects, when they become visible, in javascript

I have a table that represents Tab-structure. Some cells are set to display: none; and only the active tab is displayed. I want to set the max-height to all of them. To do it, I go through the array of tabs and do the following // get the max-tab-height for (var i = 0; i < TabPageList.length; i++) { // get max height if (TabPage...

What does ExtJS ComboBox triggerAction: "all" really do?

I tried to create a simple ComboBox: var combo1 = new Ext.form.ComboBox({ store: [1,2,3], renderTo: document.body }); But written this way it acts strangely: When you first time pop open the dropdown, it offers three choices. You choose one. But when you after that try to change your selection, the dropdown only offers one choic...

Handling errors with YUI's uploader

I am using yui-uploader from YUI 2.6.0 When an upload error occurs, I disable the uploader, show a warning, and then when the user clicks ok, enable it again. Subsequent to this, selection of new files works, and the file list is populated correctly. However the uploads do not start. Has anyone encountered this problem? How do you han...

Good .NET libraries for working with JSON data?

I am currently trying out Json.NET, and it seems to work well. Any other good JSON libraries for .NET? ...

How do I format a Javascript Date?

How do I format this date so that the alert displays the date in MM/dd/yyyy format? <script type="text/javascript"> var date = new Date(); alert(date); </script> ...

Get the scrollbar sizes in javascript

How to determine the height of an horizontal scroolbar, or the width of a vertical one in javascript ? ...

Styling of on-page scroll bars

I am working on a site to the specification of a designer who loves to put styled scroll bars on the page (not the main scroll bar on the right, but for various fixed-height divs on the page, when the content overflows). I'm not asking if this practice is "right" or not, and I know it's generally accepted to be a bad idea in terms of us...

jQuery round corner code for IE8 in standards mode?

I need a solution for round corners using javascript with or without jQuery in IE8 standards mode. ...

Javascript extracting number from string

Hi, I have a bunch of strings extracted from html using jQuery. They look like this: var productBeforePrice = "DKK 399,95"; var productCurrentPrice = "DKK 299,95"; I need to extract the number values in order to calculate the price difference. (So I wend up with ≈ var productPriceDiff = DKK 100"; or just: var productPriceDiff ...

javascript: get access to objects in different frame?

if I have 2 frames of a frameset on 1 page, is there a way for JS to access elements from the opposite frame? Thanks! ...

how do I get the string representation of the users timezone using javascript?

I want to output the users system timezone, e.g. "EST". How can I do that, preferably using Javascript, though I could do it on the PHP side as well, if that's significantly easier. ...