prototype

Unable to use "class" methods for callbacks in JavaScript

I'm having a really rough time wrapping my head around prototypes in JavaScript. Previously I had trouble calling something like this: o = new MyClass(); setTimeout(o.method, 500); and I was told I could fix it by using: setTimeout(function() { o.method(); }, 500); And this works. I'm now having a different problem, and I thought ...

Prototype Ajax.Autocompleter in dynamically added HTML does not work

Hey, this is the first time I've actually finished writing up a question without SO giving me the answer in the process. :) I've got a nested form (along the lines of Ryan Bates' Railscast tutorial on the topic) which allows users to dynamically add additional fields for adding/removing nested models using Prototype-based javascript. Th...

Image refuses to resize even via developer tools?

Hey all, I'm trying to customize a lightbox script (prototype) to make it resize images that are bigger than the viewport. I've successfully inserted a basic proof of concept to resize the lightbox overlay and everything that belongs to it, except for one important detail: the image itself won't resize. I've tried adding the resize fun...

How does the javascrpt creat a object?

function Person(name) { this.name = name; this.say = function() { console.info('I am ' + this.name); } } var p=new Person('stackoverflow'); Someone tell me that the above codes are equals to : function Person(name) { this.name = name; this.say = function() { console.info('I am ' + this.name); } ...

What does () accomplish in a subroutine definition in Perl?

The following code is lifted directly from the source of the Tie::File module. What do the empty parentheses accomplish in the definition of O_ACCMODE in this context? I know what subroutine prototypes are used for, but this usage doesn't seem to relate to that. use Fcntl 'O_CREAT', 'O_RDWR', 'LOCK_EX', 'LOCK_SH', 'O_WRONLY', 'O_RDONL...

Any open source alternatives to balsamiq mockup

As the title reads, I'm looking for open source alternatives to balsamiq mockup for prototyping. Anyone knows of an equally good alternative that's open source or basically freeware. ...

Javascript + CSS Input style variations

Hi guys This is my first question on stackoverflow, I have found this site very useful in the past and although I do not have a specific question I would like anyone's input. I love Prototype JS and use it to design my own components frequently, my problem is presenting data to users so they can make a selection, i know all the obvious...

Tracer Bullets vs Prototypes

Hi, I've started reading The Pragmatic Programmer, which I am enjoying and learning heaps form but I'm having difficulty understanding the difference between tracer bullets and prototypes. Are tracer bullets like having all of the views of an application there but not yet adding the entire functionality? Thanks ...

Javascript Hover Content Show

Hello, I am attempting to write a JS function (using prototype in rails) that will show hidden divs within a li when that li is mouseover'ed. Each li has a unique id that is a number, like so: <li id="100"> <div style="display:none;" id="hover-display-content">Content</div> <div style="display:none;" id="more-hover-display-content"...

How to add contentEditabled div with prototype in IE8

Hi I have the following piece of code: <form action="/fake" > <div id="root"> </div> </form> <script type="text/javascript"> var root = Element.extend($("root")); function addTextControl() { var textCtl = new Element('div', { 'contenteditable': 'true'}).update("Next page"); root.appendChild(textCtl); ...

Prototype Hover Content and Children

I am using: Event.observe(window, 'load', function() { $$('li').invoke('observe', 'mouseover', function(event) { this.children[0].toggle(); }); $$('li').invoke('observe', 'mouseout', function(event) { document.children[0].toggle(); }); }); <ul> <li> <div style="display:hidden;">Hidden Div</div> <div>More...