javascript

JavaScript !! operators

Possible Duplicate: What does !! operator mean in javascript? I've seen operator ! used like !!. For example var filter = !!(document.body.filters); If I'm not wrong it's equivalent var filters = typeof document.body.filters != 'undefined'? Is it a good practice to use !!? ...

Wheres the documentation for swfaddress-optimizer.js?

I am trying to make a full Flash site SEO'd and have come across a problem which it seems the swfaddress optimizer javascript can fix, but i can't find out how to configure it. Does anyone know of any documentation or examples to help me out. Thanks dai ...

How to enable hover on a div for IE6 using jquery in minmal code?

I just want to implement hover on a single div(for IE 6). what is the simplest , lightest, solution in jquery? <div class="hoverforie"> </div> i will add this script in IE condition comment. Thanks in advance. ...

how to add anything in <head> through jquery/javascript ?

I'm working with CMS i'can't edit source of . can i add any in through javascript? Edit: For example I want to add this <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> just above <title> ...

JavaScript exception handling - displaying the line number

When catching / handling exceptions in JavaScript, how can I determine what the call stack was when the exception occurred? (and also if possible what the line number was) try { // etc... } catch (ex) { // At this point here I want to be able to print out a detailed exception // message, complete with call stack, and if pos...

Make initial capital in a user-supplied control name

I have a function with the name MakeInitialCapital. I want to supply control name as an argument and the text in that control must be converted to Initial Capital. How to modify this Javascript code: function MakeInitialCapitalControl(controlName) { TextInControl = getElementByID(controlName).value; return str.toLowerCase().replace(...

Calling Python from JavaScript

Is there a simple way to call Python libraries from JavaScript? Especially from the inside of a Firefox extension. A good option to compile a pure Python library would also be great. I looked at Pyjamas, but it seems to offer only partial support for Python. ...

javascript regExp compatibility in IE

^(?=[\w-%&?#=]+\d)(?=[\w-%&?#=]+[a-zA-Z])[\w-%&?#=]{8,12}$ Was meant to match the below conditions in a javascript based new-password check, Must contain minimum 8 to 20 characters, mandatorily including one letter and number May include only one of the following special characters: %,&, _, ?, #, =, - Cannot have any spaces With ab...

Verifying date format

I want to verify that the date entered is in yyyy/mm/dd format. If by mistake user enters in dd/mm/yyyy format, it must automatically convert to yyyy/mm/dd using Javascript function. Edited: function CheckDateFormat() { EnteredText = document.getElementById('LDate').value; LengthOfText = EnteredText.length; Status = true; for(i=0;i...

Why this javascript is not working in IE?

I am using the following javascript to dynamically add rows in a table:- var trObj = document.createElement('tr'); trObj.setAttribute('name', 'dynamicTR'); var tdObjEmpty = document.createElement('td'); tdObjEmpty.setAttribute('colspan', '2'); tdObjEmpty.innerHTML = '&nbsp;' trObj.appendChild ( tdObjEmpty ); var tdObj = docum...

How to put an image/icon before select option text?

Looking to place different icons in front of items/options in a HTML select box. ...

How to disable IE message for reference information with JavaScript?

Hello people How to disable IE (browsers) message for reference information with JavaScript? this is the situation: I have a form that i submit, after submitting i reload the page and appears the following message : "To display this page Firefox has to resend information that will repeat previous actions (such as a demand or confir...

Is there a lightweight library to do draggable+sortable lists inside greasemonkey scripts?

I'm writing a GreaseMonkey script, as part of which I'd like to sort a list by dragging its items. I'm using mootools, but the component for sortable lists doesn't work in the GM sandboxed environment. Can you recommend a smallish library/piece of code to do list sorting in the most lightweight fashion? I want it to be independant of any...

Do browsers localize the OK and Cancel buttons of the javascript confirm popup?

In a multi-language web site, can I rely on the javascript confirm to translate the text of the Ok/Cancel buttons? If so, is it related to the browser or OS language setting? ...

Is it possible to test whether XmlHttpRequest will hit the cache instead of the server?

In IE using Javascript, is there way to know if doing a regular GET on a URL using XmlHttpRequest will pull its data from the cache or hit the server? If there is no way to know in advance, is there a way to tell XmlHttpRequest to NOT hit the server, and instead pull from the cache if possible? To clarify: I understand how browser cach...

Why isn't this small redirect working (javascript) ?

function redir(){ setTimeout(window.location = '/SV/main/main.html', 10); } I dont know if the delay is in miliseconds or seconds, but I have tried BOTH. (by adding three zeros). Problem is, the redirect is made right away, without any delay at all... why? Thanks BTW its called like this: <body onload="redir();"> ...

How to Create a Cloud Chart?

I've seen these charts referred to as tag clouds, task clouds, and cloud charts, but can anyone recommend a pure JavaScript (no Flash please) library or utility with which one can generate cloud charts? Many thanks. ...

JavaScript: set_map not working anymore

I was using built-in JavaScript .set_map function as discussed on this stackoverflow entry but not, it just stopped working. I've literally not changed my code in 2 months and now, Firebug is reporting: Error: *set_map is not a function* It appears the original poster of the Google Maps plugin is also experiencing the issue on his/her...

JavaScript: Sluggishness events? Google Chrome "Speed Tracer" extension is reporting

Using Google Chromes new Speed Tracer extension to profile my app. Appears my app is constantly reporting "Sluggish (events) 100%", which means the browser is blocking html rendering. I don't understand enough how to interpreter the Speed Tracer tool to fix this issue. Any help appreciated. My web app is: bit.ly/7J0U ...

Javascript Absolute vs. Relative URI using .execCommand('insertHTM L', false, html);

Hello all, I've been using a rteEditor very sucefully until now. The problem is in this line of code: document.getElementById(rteName).contentWindow.document.execCommand('insertHTML', false, html); I'm passing an ABSOLUTE path to the html var such as ("http://www.url.com/file.html"). But when it execute this insert command the outp...