javascript

Why doesn't this closure have access to the 'this' keyword? - jQuery

I'm a beginner to closures (and Javscript in general), and I can't find a satisfactory explanation as to what's going on in this code: function myObject(){ this.myHello = "hello"; this.myMethod = do_stuff; } function do_stuff(){ var myThis = this; $.get('http://example.com', function(){ alert(this.myHello); ...

Put a div behind another but still show up above?

Ok this question may sound a bit convoluted, or at least esoteric, but I'll try my best to elucidate. In my charting application I have a div which is used as a popup tool tip. This tooltip appears when you hover over a datapoint and gives you some information. I used z-index to make the tooltip render above the underlying chart div. H...

jQuery UI without HTML

Is there a project (open source) that takes the widgets and plugins for jQuery UI but allows us to use them without setting up any HTML? Kinda like Ext-js and Sproutcore, but without the acidental complexity and lack of fluidity, and more like Cappuccino, but without requiring a Mac and the horrible load times from Objective-j (which al...

maintain scope with javascript

How do I maintain scope with this? Original var Base = new function() { var canvas; var context; this.init = function() { console.log("Canvas: " + $("canvas")[0]) this.canvas = $("canvas")[0]; console.log("Context: " + this.canvas.getContext('2d')) this.context = this.canvas.getContext...

Adding a custom method to the document object is 'undefined' in IE8

For some reason the following code does not work as expected when in IE 8, as noted in the comment. I'm trying to add a "writeSpecial" method to the document object, and this works fine the first time that the method is called, but whenever this is called a subsequent time, it becomes undefined. However, this only happens in IE when I ...

[Javascript/AJAX] Guides/Tutorials on unobtrusive javascript/ajax

Google hasn't yielded satisfactory results. I'd appreciate it if people can provide some suggestions. Thanks. ...

Javascript scope question - chrome extension

for(var p = 0; p < xmls.length; p++) { var feed = new google.feeds.Feed(xmls[p]); feed.load(function(result) { //code In the above code, if I output p outside of the feed.load function, I correctly see that p iterates. However, if I output p inside that function (where I need to access it), It remains at 2 (which happens to be...

JavaScript error in IE6 when opening ASPxGridView edit form

I'm using DevExpress ASPxGridView edit form, using default edit form. However when I open the edit form in IE6 and click "update" to insert the record, it causes a JavaScript error that says "type" is null or not an object". However it works fine in IE7. I am puzzled and unsure of how to resolve this. Code is below. <dx:ASPxGridView ID=...

delay the loading of 3rd party javascript

Is there ANY method to delay the loading of 3rd party JavaScript files until the rest of the page has finished loading? ...

Converting a multi-dimensional array (javascript) to JSON (or similar) for transport.

I'm generating a multi-dimensional array in javascript that looks like this (this is the JSON representation of the javascript array, it's not in JSON format): "100": { "40": { "subtotal": "24.99", "turn-around": { "0": "2-4 Business Days", "1": "Next Business Day (Add $15.00)" }, "shipping": { "...

how to hide text in an html textbox

i am having a simple html text box what i want just as the user type something in it the text should be invisible but the text should be there <html> <head> <title>My Page</title> <script type="text/javascript"> function hide() { document.forms["text"].style.visibility = 'hidden'; } </script> </head> <body> <form name="myform"> <div al...

Javascript only working in Firebug

I am using jQuery UI to build tabs on my page. That works well until I add this following piece of code. $(function () { $('#tabs').children("div").each(function (index) { $('#tabs').tabs('load', index); }); }); I'm trying to preload the tabs. What is interesting, is that if i run this through Firebug and put a breakpo...

Sometimes in Safari the first click isn't sent to the popup

I used different methods including "onclick" and jquery. http://sky-walker.net/temp/test.htm On Safari (for Windows at least), the first click after a popup appears (alert, prompt or confirm) isn't handled by the popup... e.g. in my test trigger a popup then hover or click on the checkbox... the first click doesn't register with the "o...

No client script to check file size before uploading [Discusssion Question]

Hi All, I am developing the web based application which require to check size of any file before uploading it on server. It would have been easy if there was any means by which web developer can check size of file at client side instead of checking at server side which could avoid unnecessary trip to server. Is there any security conc...

douplacate drop down menu onchange

I use drop down menu - that contain all tags- for select tags for a topic. so, I need after users select a first tag, new drop down menu appere , and so on. ...

How to get Facebook user's friends information using JavaScript SDK

I am using the Facebook JavaScript SDK. I am able to get the user's information using: FB.api('/me', function(response) { .... }); I get the user's friends using: FB.api('/me/friends', function(response) { ... }); //.. it only has two values name and id. I want to get friends Date of birth and location. Is there a FB.api method...

json error: parsererror

Hello Guys, am developing a balloon notifications for my social network. i came across this error when there's 2 or more notifications. i checked my json response on jsonlint.com i got error at line 6 JSON response: { "nid": "1101", "img": "<img src=\".\/images\/icons\/he_wall_post_icon.png\">", "notifier": "Sarah O&#03...

how to get the geo data from geo-rss via google ajax feed api .

this is my code that has geo-rss from google maps rss: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Google AJAX Feed API - Simple ...

setTimeout Problem..

hello sir, i got a problem with setTimeout.. i dont know why this will not work.. $(document).ready(function(){ var counterNum = 0; function tick() { addText(counterNum); setTimeout('tick()',1000); counterNum++; } function addText(strNum) { $("div.counter").empty(); $("div.counter").append(strNum); } }...

Is 000,000,000.00 greater than zero?

I have an input mask on my text box like 000,000,000.00 I have the following jQuery code to check the value of text box before submitting data. var txt_box = $('#txt_box').attr('value'); if(txt_box <= 0 ) But now even if I didn't input any data, the box remains empty with only the input mask, data is submitting. ...