javascript

DIV Vertical Scroll bar on left

Is it possible to put DIV's Vertical Scroll bar on left of the div with css? what about jscript? ...

Preventing auto-creation of global variables in Javascript

I just spent some time debugging a problem that boiled down to forgetting to use the var keyword in front of a new variable identifier, so Javascript was automatically creating that variable in the global scope. Is there any way to prevent this, or change the default behavior, without using a validator like JSLint? Running a validator i...

jQuery: wait for function to complete to continue processing?

Hey all. I have, what appears to be, a trivial problem. I have the following JavaScript: $(function() { var r = GetResults(); for(var i = 0; i < r.length; i++) { // Do stuff with r } }); function GetResults() { $.getJSON("/controller/method/", null, function(data) { return data; }); } Due to the fa...

SWFAddress and Thickbox (or JQuery?) Not Playing Nice in IE6/7

I have a simple little lightbox form, activated by a link in my footer, implemented by the jQuery Thickbox plug-in (v3.1). It works fine in Chrome, Firefox and IE8. But in IE6 and IE7, the lightbox works only intermittently. In most cases, a new window is opened instead. This is not cool. The thing is, if I remove the reference on that ...

Memory leak involving jQuery Ajax requests

I have a webpage that's leaking memory in both IE8 and Firefox; the memory usage displayed in the Windows Process Explorer just keeps growing over time. The following page requests the "unplanned.json" url, which is a static file that never changes (though I do set my Cache-control HTTP header to no-cache to make sure that the Ajax requ...

Why is Rails' asset cache not working for JS in the staging environment?

I have my CSS and JS set to cache in RAILS_ROOT/app/views/layouts/application.html.erb: <%= stylesheet_link_tag 'reset', ... 'layout', 'colors', :cache => 'cache/all' %> <%= javascript_include_tag 'jquery-1.3.2.min', ... 'application', :cache => 'cache/all' %> If I turn on caching in ...

Problems with custom alert box via jqueryid dialog

I've been working on a custom alert box that has the same style as the rest of the website via jquery-ui. It was working well except that it wouldn't open more than once. As I was trying to fix that, I broke the whole thing some how, and now I get this error: Node cannot be inserted at the specified point in the hierarchy" code: "3 B...

Help with wordpress and adding jquery please

I have never messed with wordpress much and am real stuck. I am trying to add a video playlist/gallery via jquery. Not a wordpress plugin. I am not even sure what I am doing wrong and am hoping someone could help me through it please. The site is here, http://okaysewwhat.com/ it is just a skeleton now since this does not work yet. Th...

html && css - images highlighting

Hi guys, I have images in my gallery. I want to highlight them (for example, white glow), when mouse is over. Could I do it using javascript/css/html for all browsers? ...

More batch geocoding questions with the Google Maps API v3

I'm trying to figure out a nice way to limit the rate at which I send geocode requests to the Google Maps API v3 geocoder service. I know that Javascript does not have any nice wait or sleep because its execution is, for the time being, single-threaded. Each geocoder request is sent inside of a jQuery each function. So, the general code...

scope in javascript

Hi all, i have encountered the following curious piece of code: function foo(){ works = {hello:"world"}; function bar(){ alert('does not work'); } var notwork = {hello:"world"}; } foo(); alert(works.hello); alert(notwork.hello); Can someone please explain to me why works work, and notwork doesn't work? Or point me...

How do I script for resetting the default font size with Javascript?

This is related to this question. The answer was given with the script below to reset the font size back to the default: function resetToDefaultFontSize() { var p = document.getElementsByTagName('div'); for(i=0;i<p.length;i++) { p[i].style.fontSize = "12px"; } } This works fine for a page that only has one font size of...

Control embedded Imeem and Youtube players with Javascript

On Songza you can pause / resume a song by pressing Spacebar. How do they accomplish this? I guess these embedded players expose some kind of Javascript API? If they do, where is it documented? ...

How to intercept a site http request using javascript?

Hi, I need to hook all links, images, css and js call URLs inside my site and execute some operation when an event occurs with then. Anybody knows how to handle all these events? Best regards, And Past ...

Change query argument of jQuery suggest plugin

This question is kind-of crappy because I try to get around some limitations: Current JS sends an ajax query with the following code jQuery('#searchbox').suggest('/?live=1'); What the server get is the following query string: ?live=1&q=searchstring Problem: The server expects the query string to be preceded with 's=' not 'q=' I h...

JS callback on asp button

Um, I have this guy: <div class="buttonRight"><asp:Button ID="btnOK" runat="server" Text="OK" Width="68px"/></div> which renders out to <div class="buttonRight"> <input type="submit" name="_$_$pc$pc$tabTO$_$uc0$popupSelectCompetition$btnOK" value="OK" id="____pc_pc_tabTO___uc0_popupSelectCompetition_btnOK" style="width:68px;" /></div>...

JS: if statement issue, how to find element in body?

Hi, I am trying to write a simple if statement in javascript (jquery library) that simply finds the div.video element in the page and if it can find it set the variable 'arrows' to true, if it can't to false. Here is what I have so far: jQuery(document).ready(function () { // Hiding of prev & next arrows on movie pages. var arrows...

How to focus an HTML checkbox in IE, causing it to gain highlight

I'm having some trouble programmatically causing an HTML checkbox object to become highlighted after gaining focus. Here is a simple example of the code I'm using: <script type="text/javascript"> function doIt(){ document.getElementById("theCheckbox").focus(); } </script> <input type="button" onClick="doIt()" value="Pus...

Basic JSON.parse question

I can't seem to access my objects. after parsing the server string: var json = JSON.parse(myJsonText): I get the below with an alert: alert(json.param1) {"ID":17,"Name":"swimming pools","ParentID":4,"Path":""}, {"ID":64,"Name":"driveways","ParentID":4,"Path":""} Now, I am trying to access ID and Name. I have tried: json.param...

How do you use Javascript to populate a text field with data based on a select box?

I know a good amount of PHP, but know very little of Javascript. Basically, what I want is: If a user selects item x from an HTML form select box, then the descriptive text for item x will auto populate an HTML form input text box below it. Does anyone have a working sample that I can use or edit to be able to do what I need? ...