Skip to content
Advertisement

Tag: javascript

Browser Timeouts

Do browsers have built in timeouts and if so what are they? I have a page that does an AJAX call on a process that takes at most 5 minutes to run. Someone said browsers timeout after 2 minutes but didn’t know if there was any truth to that. Answer It’s browser dependent. “By default, Internet Explorer has a KeepAliveTimeout

How to convert variables into json?

I want to send json data to ajax but how do you convert variables into json or convert an array to json? Answer If you really want to convert the data into JSON, you have to create an object or array and use JSON.stringify (available in newer browser and can be loaded form here): but you cannot just set the

Javascript Hanging UI on IE6/7

Could anyone suggest performance improvements for the function I’ve written (below, javascript with bits of jquery)? Or point out any glaring, basic flaws? Essentially I have a javascript Google map and a set of list based results too, and the function is fired by a checkbox click, which looks at the selection of checkboxes (each identifying a ‘filter’) and whittles

Why doesn’t JavaScript newlines work inside HTML?

I have the following: As you probably all know, n doesn’t work and I have to use <br> instead. It won’t work either if I link to an external .js file. Here are my questions: Why doesn’t n work? Why does <br> even work? Shouldn’t everything that’s inside the script tags be strictly JavaScript instead of a dirty mix between

Format a Number, Exactly Two in Length?

I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example: 01 02 03 … 09 10 11 12 … Answer Update This answer was written in 2011. See liubiantao’s answer for the 2021 version. Original

Change CSS of class in Javascript?

I’ve got a class with the display set to none I’d like to in Javascript now set it to inline I’m aware I can do this with an id with getElementById but what’s the cleanest way to do it with a class? Answer You can do that — actually change style rules related to a class — using the styleSheets array (MDN

Advertisement