Hello,
Can somebody give me a resource (or just explanation? :-) of what "prototype" is and how it works in Javascript. May be comparison with something in Java? (not really necessary).
But it should be as simple/easy as possible so inexperienced person just learning Javascript would understand (need to explain this to jr designer who is…
I have a few div's like this in my page:
<div class="listing-type-list catalog-listing">
I would like to append a class to the div when I hover over it then remove it when I mouseout?
How can this be done with prototype?
Is there a way to show the structure of a javascript class declared using Prototype's Class.create function in the Eclipse outline view?
The declarations look like:
var Foo = Class.create({
bar: function() {
...
},
baz: function() {
...
},
});
At the moment all I get is "Foo:".
(A google search turned up…
Hi, how can I "copy" the selected option between two s that have the same options using prototype ? I tried getting the selected option from the "master" combo using
function getSelectedArea() {
$$('#areacont1 option').find(function(ele){return !!ele.selected})
}
which returns null
And setting the second combo using
var…
Hi, i'm just starting prototype, i was on jquery before.
I can't find easy examples on the internet about how :
Selecting all elements having the same id on a page
(i'm doing this but it only works for the first element : $('mydiv').hide() )
Selecting a div that is contained in another div by their id.
hiding all…
Hi,
I want to observe multiple select menus and respond to their changes using prototype but only the first menu seems to be observed. This is my code:
$('product_options').select('select').invoke("observe","change",optchange);
If there are - for example - 3 selects within product_options then it only observes the…
Hey everyone,
I'm trying to style my select box, I assume I need some type of javascript method.
I'm using rails - and sticking with prototype/scriptactulous.
Does anyone know of any solutions?
Is there any beautiful practice of defining namespace in Lowpro + Prototype Event.addBehavior? Sorry if this question reappeared earlier, but I've been googling and looking in stackoverflow for some time.
Using prototype, is there a simple method of checking that a group of values match, for example - can this code be refined to a single line or something otherwise more elegant?
var val = '';
var fail = false;
$('form').select('.class').each(function(e){
if(!val){
val = $F(e);
}else{
if(val !=…
As mentioned in this link http://stackoverflow.com/questions/1399613/disable-link-with-the-prototype-observe-method/2811085#2811085
If the link is disabled using the observe method how is it possible to enable it.
Thanks
The following works fine on IE6, IE7, and chrome. Not working on ff 3.0.7.
<html><head>
<script src="prototype.js" type="text/javascript" ></script>
<script type="text/javascript">
Event.observe(window, 'load',
function(){
Event.observe(document.body, 'keydown',…
In my project there are some 'Prototype' factories that create instances by cloning a final private instance.
The author of those factories says that this pattern provides better performance than calling 'new' operator.
Using google to get some clues about that, I've found nothing really relevant…
I am just doing a simple Ajax.Request call using the newest version of Prototype. It works fine in Firefox, Internet Explorer, and even Safari... but not in Chrome. Here is my code...
alert(url);
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport) {
alert('test');
}…
I've created a class in Javscript using the prototype Class.Create complete with the initialize function and a few other functions. However, in one of my functions I want to reference another function in the same class, but cannot seem to get the syntax correct.
e.g.
var sampleClass =…
I have created a small navigation element that is positioned right on top of another element. It is only shown when a user mousenters/mouseovers the main element. I am having some trouble with the prototype. I would like this small nav element to be hidden when a user mouses out of the…
I've created a class in Javscript using the prototype Class.Create complete with the initialize function and a few other functions. However, in one of my functions I want to reference another function in the same class, but cannot seem to get the syntax correct.
e.g.
var…
I have created a small navigation element that is positioned right on top of another element. It is only shown when a user mousenters/mouseovers the main element. I am having some trouble with the prototype. I would like this small nav element to be hidden when a user mouses…
There is currently this Prototype code that does a PUT:
new Ajax.Request(someUrl, {
method: 'put',
parameters: { 'foo': bar },
onSuccess: function(response) { } .bind(this)
});
I found this post but the solution uses an extra parameter supported by RoR, however I…
Hi, I have this code:
<input name="rz" class="required validate-string" style="margin-left:17px" id="rz" title="Input rz value" size="23" />
<p class="msg" style="display:none;">Input rz value</p>
In the head I have:
Event.observe(window, 'load',…
The following code doesn't work as I intuitively expect it to:
function MyObject(input) {
input.change(this._foo);
this.X = undefined;
}
MyObject.prototype._foo = function() {
alert("This code is never called");
// but if it did
this.X = true;
}
var…
This is a snippet from a prototype class i am putting together. The scoping workaround feels a little hacky to me, can it be improved or done differently?
var myClass = Class.create({
initialize: function() {
$('formid').getElements().each(function(el){
…