javascript

prototype confusion

This is the representation of prototype chain when I created two instances of Book constructor. The screen-shot is taken from "High Performance Javascript - N.C.Jakas". My confusion is about the Book constructor given in the middle (the yellow box with the heading "Book"). As every function in javascript is an instance of Function pro...

What's the best way to implement a sleep function JavaScript?

I'm aware of both setInterval and setTimeout functions but it's not suitable for my case, because I need to create an img DOM element in the interval of 7 seconds. The count of images are not predefined (varies daily). When I use setInterval, I cannot completely stop it after certain limit (daily count). [clearInterval clears iterati...

jQuery and Adobe AIR conflict

Hi people, I am trying to get this code working -- var loader; $(function() { loader = new air.HTMLLoader(); loader.addEventListener(air.Event.COMPLETE, complete); loader.load(new air.URLRequest('http://www.lilpirate.net/blog')); }); function complete() { $(loader.window.document).ready(functio...

What does this error mean in Firebug?

Possible Duplicates: Firebug JS warning to jQuery 1.4.2 The 'charCode' property of a keyup event should not be used. The value is meaningless. To ignore it? Firebug: The 'charCode' property of a keyup event should not be used. The value is meaningless. I have this error when I start typing on my textbox: The 'charCode' ...

Return to a form called with <a href login.php class="signin">Sign in</a>

I am calling a login form using jquery with. <div class="session"> <?php if($current_user): ?> <span>Welcome <?php echo $current_user['first_name']; ?></span> <li><a href="logout.php" class="signout">Log Out</a></li> <?php else: ?> <span>Please Login or Register</span> <li><a href="login.php" c...

Can I remove inline event handlers using jQuery?

I have some HTML with an onclick attribute. I want to override that attribute using jQuery. Is there any way to remove the click handler using jQuery? Using unbind doesn't work. ...

possible problems when re-locating ad banner in dom by javascript?

Hello :) I am designing a layout that looks like: == header == == ad banner == == content == == footer == however the source code order is: == content == == header == == footer == == ad banner == the idea and goal of all that is load ad code in the very end so that the page doesnt get slowed down by external loaded javascripts ...

How to know when popup is closed in javascript

This code will open go.com in popup window: <a href="javascript:void(0)" onClick="javascript:window.open('http://go.com','','status=yes,scrollbars=yes,toolbar=no,menubar=no,location=no ,width=300px,height=300px')">open</a> and I want to use alert('closed!') in main page, when popup is closed and I can't edit popup page for use onunlo...

Event data passing in the inline event handlers

I have an <input> which has an onkeydown inline event handler. In this handler, I'd like to call a function and pass a special parameter to it - the event data. When I want to handle events (e.g. onmousemove) for the whole document, I use the following code: document.onmousemove=function(e) { // here I can make a good use of the 'e' va...

Is it possible to execute JSX scripts from outside ExtendScript?

Typically when you're writing a .jsx script to automate an Adobe product (like InDesign, Illustrator or Photoshop), you write, debug and execute the script from the ExtendScript IDE. Is it possible to bypass ExtendScript and run the script from an third program? I think Adobe products have a built-in JavaScript interpreter which ExtendS...

Understanding jquery source code

I have recently started to delve deeper in to JavaScript and have come across this code construct in JQuery. (function( window, undefined ) { })(window) Reading on stack overflow (and elsewhere) I have come to the conclusion that this is the same as function foo(window, undefined) { ... } foo(window); Am I correct in my assump...

can this JavaScript function be refactored?

I need to use prototype JavaScript library on a project and wanted to add tabbed box to HTML. The click handler has a simple task - set selected on parent <li> element and show linked DIV id element (rel tag on <li> has element id name) <div class="tabInterface"> <ul class="tabSelector"> <li class="selected" rel="searchLast"><...

Detect order in which checkboxes are clicked

Hello, I am trying to make a page that allows users to select 8 checkboxes from a total of 25. Im wondering, how to detect the exact order in which they check them. I am using a plain html front page that will be verified by a form action pointing to a php page. Im trying to get a result like (checkbox1,checkbox2,checkbox6,checkbox3,ch...

Trigger a select form element to show its options (open drop down options list) with Javascript.

Here is the markup <select id="person_prefix" name="prefix"> <option value=""></option> <option value="Dr" selected="selected">Dr</option> <option value="Mr">Mr</option> <option value="Ms">Ms</option> <option value="Mrs">Mrs</option> </select> and I want to trigger a javascript event so that the option list drops down. Using jqu...

Error in Firefox when making SQLite calls via Javascript

Hello, I have a site that is fully functioning in Chrome/Safari and heavily relied on SQLite to store/access data. However, when testing in Firefox, it errors on the first call, openDatabase(). This is my fairly standard openDB function: function openDB(){ try { if (!window.openDatabase) { alert('not supported'); } else...

Request to Asp page misses if called very fast

Hi, I have a website with is made in classic asp. On one page there are 5 textboxes and 5 labels. When users type some value in the textbox then using javascript (added on Onchange event) another asp page is called which done some calculations, fetches some database values based on the value typed and return the result to caller page to...

ExtJS Pivot Grid Left-Axis height different than data-cell height

I'm trying out ExtJS Pivot Grid. I'm using the examples pretty much as-is from examples (here: http://dev.sencha.com/deploy/ext-3.3-beta1-6976/examples/pivotgrid/people.html ) except I'm putting the grid in a layout so that I can have another grid below it. What seems to be happening is the Left-Axis grid 'stretches' vertically to fill ...

Is there a javascript event when items are added to or removed from the DOM?

I'm trying to build a Chrome browser extension, that should enhance the way the twitter website behaves in Google Chrome. I want to mark the top tweet that gets moved down when new tweets are loaded, and scroll to it. I'm able to fetch the top tweet before the click by hooking the mousedown event using .live(). After that, I have to wai...

how to change page from within javascript

i have the following code that changes the pages from within javascript: var newUrl = [some code to build up URL string]; window.location.replace(newUrl); but it doesn't change the top URL, so when someone clicks the back button it doesn't go back to the previous page. how can i have javascript change the top URL as well so the brows...

Javascript validation using activerecord models validators

I have an activerecord model and set of validators to it, But I also have to provide front end validation. Is there a gem or a smart way to use activerecord validators, for instance in jquery validation plugin, instead of writing it by hand? Thanks ...