prototype

prototype selector equivalent to jQuery

Hi! How can I select the popupwindow of the popup-lightbox div? in jQuery, it's be something like $('div#popup-lightbox #popupwindow'). Unfortunatly, in Prototype, it's not that easy... anyone can help me? thanks! <div id="popup-lightbox" class="popup"> <div id="popupoverlay"></div> <div id="popupdiv"> <div id="popupwi...

Prototype Newb looking for tutorials and has some code for review

I come from a land of JQuery and I'm working on a project that forces me to use Prototype. I thought it would be simple but I think I'm missing something obvious. Somehow I wrote some code that works in every browser but firefox, that's a first for me. I tried looking for some tutorials for prototype but everything directs me to JQuery. ...

Prototype JS source what does this mean? Array.from = $A... Hash.from = $H;

Just wondering what are the side effects or what does this mean or do. I noticed it in two parts of the source code for the Prototype JS library. Hash.from = $H; Array.from = $A; any clarification would be greatly appreciated, and Thank you in advance. ...

Prototype and jquery plugins not working together

Hi Good people, Please help me i have lost 1.5 days trying to fix this, i have looked for various solutions on the internet and none seems to work,atleast for me.I have been using jQuery.noConflict(); var $j = jQuery; to avoid jquery conflicting with other libraries successfully, but now it wont work with prototype.I am pulling hairs...

Question about prototype pattern

The objective of prototype pattern is to clone an object by reducing the cost of creation. Here is an example: class Complex { int[] nums = {1,2,3,4,5}; public Complex clone() { return new Complex();//this line create a new object, so is it violate the objective of prototype ?// } } class Test2 { Comp...

lightbox prev next position change

Hi, I am using lightbox slideshow and it is working fine, there is Next-Prev button also in that. But I want it to show at the bottom of the image and also currently it will show only when I mouseover the image, is there any way to show it permanently. I am using Lightbox v2.04 Thanks deve ...

Ajax.Request doesn't work in IE

Hi I using prototype javascript I am using ajax function which works perfectly in FF but not in IE var MOList_VenuePostBox; function getPreSearch(tid,tname){ include_js("http://" + getHostPath() + "/_scripts/lib/z_autocomplete_messagecenter.js", function() { //,{fetchFile:'/ajax/spot/getmyspots.aspx'} MOList_V...

Prototype parameter names

In my header, I have a prototype declaration like this: void move(int, int); I can omit the parameter names, that's how I'm used to it from C. I do that so that I don't have to keep the parameter names in sync - it's extremely confusing if they differ between prototype and implementation. Right now, I'm documenting all of my code wit...

XSLT breaks jQuery/Prototype Script in Firefox

I am working on a school project. It's an internet page with XML / XSLT. For the design we thought about an image fading effect in the background. I made it as you can see and it works perfectly on IE7. But checking it in FF 3.6 throws some suspicious errors in firebug und does not work. For example: alert($('menu_bg').innerHTML); ...

Free alternative to Prototip?

I'm redoing the tooltips on a commercial site and am looking for a good tooltip library to use. Some of the pages use prototype already for other functions, so I need to find something based on prototype that can do the following. Dynamic positioning, meaning if the tooltip would fall outside of the window then it is moved to a better...

Is there a memory performance benefit of assigning a function to the prototype in Javascript?

I read that adding functions to an object will chew up more memory then adding functions to the prototype of the object. function Obj() { this.M = function() { // do something }; } var o = new Obj(); The idea was that for every construction of Obj, a new function is created and applied to Obj, thus increasing memory use. For 1000...

onclick handler not firing for checkbox created with document.createElement

Hello all. I am going insane trying to figure out why this is not working. I am creating a checkbox dynamically with JS to enable/disable a text field (also created dynamically). Code is pretty simple: var text = $(document.createElement("input")); text.type = "text"; container.appendChild(text); ... var check = $(document.createEle...

What is the jQuery equivalent of the Prototype function .activate()

Prototype's activate function Gives focus to a form control and selects its contents if it is a text input according to the Prototype website. i.e. $('my_element_id').activate(); What is the equivalent function in jQuery? ...

Javascript/Prototype adding two event handlers to a single field when I just want one.

I'm using prototype to attach event handlers to a number of form fields. The form fields are named "ContactAddress", "ContactCity", "ContactState", "ContactZip" as well as another set that begins with "ContactProfile". Now, the event needs to be able to tell the difference between when I'm updating a "Contact" field and a "ContactProfi...

Handling events using Prototype

So I have the small code snippet below, which I would ideally like to call the function to alert me with hello when the #results_more element is clicked... $('results_more').observe('click', function(evt) { alert('hello'); }); However, I think I'm doing something terribly wrong if something this easy doesn't work. Anything I may b...

Extending native elements in JavaScript via prototype?

Would you consider extending the native elements via the prototype dangerous? I see some frameworks such as Prototype doing this so I have started to wonder if I dare to do that too. I am worried about implementing things like addClassName and make it collide in the future in a way that I can't resolve any other way than rewriting the ...

Hoverintent for Prototype / Scriptaculous

Recently came across the HoverIntent plugin for jQuery. It acts like a regular mouseover or hover observer, but waits to fire the action until/if the mouse slows down or rests. With tuning, it makes for interfaces that feel more human responsive. The website I'd like to use it on is committed to a Prototype / Scriptaculous framework...

http.ServerRequest.prototype

I want to add my own method to http.ServerRequest object. But http.ServerRequest is null. I tried requset.prototype.testtest = function() { console.log('aaaaa'); }; in server callback. It answers 'TypeError: Cannot set property 'testtest' of undefined'. How to add method to ServerRequest objects? ...

Does using prototypes in JavaScript have any real world advantages?

I just finished Doug Crockford's The Good Parts, and he offers three different ways to go about inheritance: emulation of the classical model, prototype-based inheritance, and functional inheritance. In the latter, he creates a function, a factory of sorts, which spits out objects augmented with desired methods that build upon other obj...

Arguments for Prototype over jQuery for Rails?

I have never used Prototype before. But now when I'm using Rails, it seems to me that it doesn't only manipulate the DOM/Ajax but also the language itself. Example: http://api.prototypejs.org/language/hash/ It was a long time ago I used jQuery, but I recall that the framework didn't have these features right? Is this a good feature f...