javascript

How to "lock" columns in an HTML table?

I am pulling back a large amount of tabular data that I wish to display using a table. The only caveat is that I would like to be able to "lock" a few of the columns (fname/lname/email) so that when users scroll horizontally those columns always stay "locked" in place and are visible. I have done something similar to this before but th...

How to generate a right-click event in all browsers

A little context: The app I'm working on has a right-click context menu for certain objects on the screen. The current design as that each of these objects listens for a right-click, sends an AJAX request to get the context data for that object, uses that data to create a PopupMenu2 from Dojo 0.4.3 (I know!), and then generates a right-c...

Jquery tranversing DOM to find consecutives values

Thanks for looking, all helpful answers are voted up. This is my markup. I'm trying to find 2 consecutive divs cmk1 and cmk2 with the content RIGHT and HERE in consecutive order. div id 1 shouldn't match because there's a right but not here. div id 3 shouldn't match because there's a here but no right. I'm trying to find something t...

Passing query string to JS window.open in IE7 doesn't work?

I can run the following via the address bar in Firefox just fine: javascript:window.open("http://my.hostname.com/test.php?id=12345", "exportWindow"); When I print_r($_GET), I see the $_GET array with the values I specified in the URL. But when I do so in IE7, it just prints "null" on screen. EDIT Turns out that was due to a popup bl...

Create image Thumbnails before or after upload the best way?

Hi. Imagine you have a classifieds website... When searching ads you want image thumbnails of the "real" image which displays in its real size after clicking the ad... Would it be faster to create the thumbnails per search, or create the thumbnails on and then just display them? Storage is not a problem on my server... Thanks ...

Rhino Javascript:

I am utilizing the javax.scripting with Rhino in this project. I have a Java method that returns a Java Object (Double, Long, Integer, etc). I want to call that method from javascript and reference the result as a Javascript primitive type. However, javacript recognizes the return type as an Object. How do I force it to convert...

Web based method to determine if an iPhone is connected via 3G or Wifi

I'm in the process of building a webapp that allows users to view a video podcast. At present, the user can select whether they would like low or high bandwidth videos depending on whether they are connected via 3G or Wifi. Is there any way that a webapp could determine this? I know of one way that could use the IP of the device to dete...

Is there the difference in JS execution in IE6 andIE7

seems thats it is ...

JavaScript Variable Scope

I'm having a problem with some JavaScript code. Script setTimeout(function() { for (var i = 0; i < 5; i++) { setTimeout(function() { console.log(i); }, i * 200); } }, 200); Outputs 5, 5, 5, 5, 5 instead of 1, 2, 3, 4, 5 I can kind of understand why this doesn't work, but I was wondering if someon...

Reloading or redirecting the parent from a child iframe in safari.

I am generating an iFrame that following some processing with the frame (from an external site) redirects back to my domain (within the iframe), which should then reload the parent frame. However I've tried multiple ways of calling the parent, but none of them seem to work in safari? methods use include. self.parent.location="/"; self....

Using Bookmarks with jQuery Address

I am using jQuery's Address plugin (website) to enable the back/forward buttons on my website. I would REALLY like to also have the ability for people to bookmark pages and to copy the address from the address bar and share it with friends. Address claims it can do this, so then what am I doing wrong. My code is function BackButton()...

Hiding a div using JQuery

Hi, I want to hide a div using Javascript, as soon as the page gets loaded in the browser. I am able to do that, if i use the following code : document.getElementById("div_id").style.display='none'; But, when i try to do the same thing using JQuery,i notice that the div is visible for a couple of seconds after page loads,and then it ...

shift-reload in FF gives unexpected results

dear javascript mavins, I'm presenting a simple animation using img.src replace and the <canvas> tag. At present it's only expected to work in FireFox (FF 3.5.3, Mac OS X 10.5.5), so cross-browser compatibility isn't (yet) an issue. When the page is first loaded, or loaded into an new window or tab, all seems to work as expected, and t...

Split a string in ASP Javascript

I am trying to split a string from a recordset that is in the format DD/MM/YYYY. So basically something like: Homework.Fields.Item("DateDue").Value.split("/") But that doesn't work, Normally I can do: String(Homework.Fields.Item("DateDue").Value).split("/") But using String() turns the value into a long thing like: Wed Oct 26 00:...

Facebook Connect help.

According to the Facebook API documentation, most of the work is handled through javascript. That means that all the processing is done, and then the front end checks if the user is connected to Facebook/authorized. right? My question is: Suppose a user goes to my site for the first time ever. He clicks on "facebook connect". The ja...

JSON: why are forward slashes escaped?

The reason for this "escapes" me. JSON escapes the forward slash, so a hash {a: "a/b/c"} is serialized as {"a":"a\/b\/c"} instead of {"a":"a/b/c"}. Why? ...

IE can't see objects in .load DIV Jquery

I have a form loading on a page that loads with an onclick event on the parent page using the following javascript. It gets loaded in a DIV. function loadContent(elementSelector, sourceURL) { $(""+elementSelector+"").load("http://myurl.co.nz/"+sourceURL+""); } Then on another on click event (within the new form) one of the fields in ...

Create a div containing target div using jQuery

I think that this should be easy, but i'm not able to get it working. I want to target a div or other element using jQuery and then dinamically create a div containing the targeted element, for example: jQuery ('.myclass') how can i create a div with the background-color attribute set to white that contains 'myclass' element? Initiall...

YUI: would it make sense for YAHOO.lang.extend to carry "static" methods to subclasses?

Consider the JavaScript code below, inspired from the YUI documentation on YAHOO.lang.extend. In this code Class1 has a "static method" named factory() (say because it is a kind of object factory). Class2 inherits from Class1 using YAHOO.lang.extend. Why wouldn't factory() be automatically defined in Class2? Is this a reasonable expecta...

Call the methods in mootools class

Dear friends I have a question about calling other functions in a mootools class. For example: var f = new Class('foo', { test1: function(){ var table = new Element(........); .... ... $(table).getElements('input').each(function(input) { input.addEvent('change', function() { **// how c...