prototype

rails calendar select with time zone?

My client wants to have a calendar picker with support for time zones. Right now they are using the venerable calendar_date_select picker http://code.google.com/p/calendardateselect/ Which has no support for time zones. Surprisingly, I can't find any other plugins or other help in handling this. I would think this was a common probl...

Rails Ajax Hide/Show Toggle Link using RJS

Hello, I want users to be able to comment on submissions. Below each submission I want there to be a link that says "Comments (2)"...when you click on this link it dynamically loads in the comments, as well as a simple form to add a new comment. When the user submits a new comment I want it to load asynchronously in at the bottom of the...

RoR dialog box prototype

Hi, Does anyone know how to create a dialog box, which will appear one time for new users when they first visit their 'home page?' Thank you. ...

update sIFR text after ajax update.

I am using sIFR version 3 in my site. I am updating the text in a div with id 'points' from an ajax request. I want to update the text and apply the sIFR to that div after the text is changed. Please suggest a solution. here is my update code new Ajax.Request('score.php', { onSuccess: function(response) { $('points').update...

Simple ajax/prototype problem

Hi, im beginning with Ajax, i have problem with including Ajax files. Ajax code written in original page (like index.php) and placed in (head) section works fine, but when i try to place code in external file (in js folder, where is placed prototype.js file), i don't get any response, not even in Firefox Error Console. I haven't change...

replace content of div without changing size or scrolling

Hi all, I'm trying to write some code which replaces old content with a placeholder while new content is loaded (via ajax). <div id="target"> ... </div> During the ajax request-response cycle, i'd like to replace the content of the target div with a 'loading' message or image. So far, this is simple ... However in some cases the ta...

onmouseout event control.

I have a DIV with a mouseout observer. This DIV have also child Elements. mouseout event will alse be fired if the mouse pointer enter any of its child elements. How can I prevent this behavior? ...

compressed / minified prototype file.

I need a compressed minified prototype file. Can anyone help me? Thanks ...

Is it possible to use a complex json object with a Prototype template?

Say I have an object such as: { id: 345, title: 'Some title', body: 'Here be a lot of text', author: { id: 1 name: Bob email: [email protected] } } How would I reference the properties of the author in my template e.g., var template = new Template(' <div class='blog_post'> <...

Question about executing javascript post-processes in Java app

Traditionally we have always used xml in the response which is parsed by a Javascript method to execute post processes. I came up with a new, simpler implementation which uses a hidden input set by a requestAttribute and executed in an ajax callback. JSP: <% String jsPostProcess = (String)request.getAttribute("jsPostProcess"); ...

What are practical use cases of javascript prototype objects?

How are you using javascript prototype objects in your everyday code? I found it hard to either explain or find use cases for it. Purpose driven examples and pseudo code examples would be great - thanks! ...

prototype and document.getElementById()

Why doesn't this work? Maybe someone could enlighten me :P var balloon = function(){ }; balloon.prototype.iHeight = document.getElementById("wrapper").clientHeight; window.onload = function(){ var oBalloon = new balloon(); } Im just trying to understand prototype a little better. ...

IE8 bug in for-in JavaScript statement?

I think I've found a bug in IE's (IE8) handling for the for-in javascript statement. After several hours of boiling this down to a small example, it looks like IE specifically skips any property called "toString" in a for-in loop - regardless of whether it is in a prototype or is an "Own Property" of the object. I've placed my test cod...

How to get multiple html controls to use the same event handler

I have some javascript and am creating some html on the fly. What I want to do is add an event handler to each control (they are all “Input” controls) so that if I click on any of them they all fire the same event. I first define a delegate in the initialize section of the code like this: this.rule_event_handler = Function.createDelega...

add onclick event on various elements on the basic of css class.

I have various elements on a single page. They share a single class. I want to add a onclick event on all those elements using prototype. For id i can do something like this_ Event.observe(window, 'load', function() { $('id_of_the_element').addEventListener('onclick',any_function,true); } ); This is good if we have id of the el...

Manipulate href of anchor based on class in Prototype

I'm trying to manipulate some anchors after the document is loaded to alter their href attribute using Prototype. Based on the class of an anchor, its href has to be rewritten to be used by a tracking software. I hacked some things together but can't quite figure out why it doesn't work. It always returns undefined, not matter what I se...

magento checkout: change shipping price

Scenario: Change shipping price using variable parsed by design during checkout. I need to change the final shipping price using some variables sent by phtml checkout. Eg. Shipping method 1: cost 33$ Shipping method 2: cost 23$ Shipping method 3: cost 10$ special packaging checkbox (y/n) + 10$ (set it as yes for this example) ...

Opera javascript

This code function is runing when mouseover in div with interval 10ms It is using framework prototype 1.6.0.2 In all another browsers it works fine but not in opera function openMenu(){ var pleft = $("slidemenubar2").getStyle("left"); if(parseInt(pleft) < 0){ $("slidemenubar2").setStyle({left: (parseInt(pleft)+10)+'...

Properties attaching to wrong object

I've adapted the Crockford object() function so that I can pass in some parameters and autorun an init function in the new object: function object(o) { function F() {} F.prototype = o; var params = Array.prototype.slice.call(arguments,1); var obj = new F(); if(params.length) { obj.init.apply(obj,params); } ...

link_to_remote doesn't work :with using jrails

I am trying to use link_to_remote with :with parameter so I can pass my parameters but I am using jrails and it seems it doesn't work. I use it another spot with jrails and prototype and it worked fine. Here is my code in jrails where I don't use prototype: <%= link_to_remote render(:partial => "back_button_text"), {:url => { :contro...