javascript

jQuery UI datepicker IE problem

Dear, I checked related posts but none of these answered my question. So this is the code i use: <script type="text/javascript" src="/media/datepicker.js"></script> Inside the datepicker.js i have the following: $(function() { $("#id_picker").datepicker(); }); I also tried to put document.ready() around it, but that didn't hel...

Return array *after* JSON is done?

How do I make this function return the entire array when it's done pushing all markers? function XTW_getLocations(data, div_id, map) { var markers = []; var marker; var latLngBounds = new google.maps.LatLngBounds(); $(div_id).empty(); $.getJSON('GetLocations', "country=" + data.id, function(data){ ...

Weird mapping of DOM elements into variables

Today a workmate was working on a third-party video player integration for a set-top-box and found in their documentation an example like this: <a id="say_hello">Hello</a> <script type="text/javascript"> say_hello.onclick = function() { alert("Hello world") } </script> I just suspected it was something related only with CE-HTML but...

Writing apps in JScript 5.5 instead of JScript.NET

As some of you may know JScript.NET adds quite a few features to the common JavaScript language... it adds some class syntax, some type identifier etc etc.. The main reason I use JavaScript is because I love how dynamic it is, nested function calls, variables scope etc etc... All these features seem to work fine in the .NET version, how...

Decode &amp; back to & in javascript

I have strings like var str = 'One &amp; two &amp; three'; rendered into HTML by the web server. I need to transform those strings into 'One & two & three' Currently, that's what I am doing (with help of jQuery): $(document.createElement('div')).html('{{ driver.person.name }}').text() However I have an unsettling feeling that ...

problem: onclick event in dropdown

Hi all, I have a dropdown menu and all i want is that when i click on Italian in the dropdown, the content for italian will show... Basically what i want is to set the action to IT when i select Italian from the dropdown.. Any help please?? <% action = Request.QueryString("action") %> <form name="contentchanger" action="/...

HTML5 onpopstate on page load

I'm using the new HTML5 onpopstate event. Using Firefox 4 the window.onpopstate event is triggered on a page load whilst in Webkit this does not seem to be the case. Which is the correct behaviour? ...

Javascript Intellisense in ASP.Net Usercontrols

As you will all probably be aware you can reference external Javascript files in Visual Studio 2010 using the following directive. /// <reference path="MyExternalFile.js" /> Great! Directives to external Javascript files that exist in masterpages are automatically transferred to content pages. Again great! However how can you create...

What is the scope of this object

I have the following code snippet which uses'event' My fellow developers argue that the scope of 'var event' is restricted to 'if' condition. Is that true. How can I make this a better code function prepForDrag(obj, event) { if(event= "undefined"){ var event=obj || window.event; } if (event.altKey) { ...

Cannot set minHeight and minWidth in SimpleModal jQuery plugin

I have read from documentation how can I set minheight and minwidth of modal dialog. $("#sample").modal({ minHeight:400, minWidth: 600 }); However, even if I rewrite the sample html from <a href='#' class='basic'>Demo</a> to <a href onclick="$('#basic-modal-content').modal({ minHeight: 1000, minWidth: 1000 });" >Demo</a>...

hidden invisible elements take space

I'd like to make some empty hidden elements (iframes would be nice, paragraphs would do) that java script would later fill and modify. I have not been able to figure out how to keep these elements from taking up space. I've turned off margins and padding and set height to zero but still end up with blank space. I'd like to see an exam...

disabling radio buttons by name attribute with jquery

say I have a bunch of radio buttons in an html form. How do I find and disable all radio input types with a given name="?" value (where ? can be anything I specify)? ...

onUnload function is not working for mozilla

onUnload is not working for mozilla but the same function is working fine for IE. Below is the code sample : <body style="background-color: gainsboro;" onload="SetScrollPosition()" onUnload="LogMeOut()"> Please suggest me the resolution. ...

Notes 7.0.3 Client throws Error in compile JavaScript on a form with not much JavaScript. Any ideas as to a potential cause?

Straight to the question and then the background. What would cause a Notes 7.0.3 client to throw a JavaScript error "Error in compile JavaScript"? Followup Question: what's a good tool for tracking JS errors in the Notes Client? My suspcions: - flaky JS written by developer(s) - unusual input by user - memory management issues (Win...

Getting MULTIPLE distances with google maps

So.. I have 10 latitude/longitude values in a database. Using the V3 JS API i plot these on a map. I then have an 11th point which is 'users current location' I want to find the distance between the user location and each of the other points. I have created a javascript which does this - essentially, it gets the lat/long, plots the ...

Automatically detect how bright a user's monitor is?

I have web application and have noticed that there exists a huge variation in users' monitor brightness settings. The brighter a user's monitor, the more washed about my web applications colors look. Is there a way to automatically detect the user's monitor brightness, without the user's involvement, so that I can programmatically adju...

Javascript error while using EncryptedLocalStore

Hi people, I am trying to make my first JS-based adobe air app. But I've stuck at a point. Here's the code which is causing the error var RunUrl = 'http://www.lilpirate.net'; var firstRunUrl = 'http://www.netbloo.com'; var snxApp = air.EncryptedLocalStore.getItem( 'snxApp' ); var semail = snxApp.readUTFBytes( snxAp...

Creating fancy HTML buttons with images

I'm using a customized <img> element as a button on my site (with onclick for the form submit). The reason being I want the element to display one image when the button is up and another for when the button is down. I'm using onmousedown and onmouseup for that. This is an AJAX-based site, and the submit is also AJAX-y. It is safe to ass...

Best way to capture javascript errors in production

I've got a serious javascript problem that is hard to reproduce in any of our DEV/TEST/PRD environments. Nonetheless, it is being reported consistently by our customers. Sometimes we think it's browser specific -- sometimes we think it's action specific -- sometimes we think it's cookie related. It's a tough one and we're getting pulled...

What is the argument for?

$(document).ready(function(){ $('#something ul a').click(function(e) { ... ... e.preventDefault(); }) }); what is the e for and the e.preventDefault mean so i can understand what is happening here ...