prototype

Load Recaptcha script with Prototype

I need to load the Recaptcha library on demand, with javascript (using Prototype): var captcha = new Element('script', { type: 'text/javascript', src: 'http://api.recaptcha.net/js/recaptcha_ajax.js' }); $$('head')[0].appendChild(captcha); captcha.onload = function() { Recaptcha.create("dsfahsldkjfhlasdjfc","recaptcha_image", {theme: "...

prototype JSON to Object

Hi, The following is part of a JSON string returned from the server: { col1: { caption: 'Workspace', combodata: { c_0: { id: 0, value: 'Filter...' }, c_1: { ...

Why won't this object's prototype's init function run

I use the following function for creating new objects. function newObj(o) { var params = Array.prototype.slice.call(arguments,1); function F() {} F.prototype = o; var obj = new F(); if(params.length) { obj.init.apply(obj,params); } return obj; } And it works well most of the time. However one of my base "classes" is now defi...

Rails 3, using Prototype and JQuery, remote => true not working

I have a Rails 3 application that needs to use both Prototype and JQuery libraries. Now I am having problems when it comes to making different kinds of remote calls. I am able to do a remote_function call and return RJS and that works just fine. But, on another page I want to do a form_for :remote => true, but that fails - it just sub...

Object Oriented Javascript vs. Pure jQuery and .data storage

My current style of programming is OO javascript using the Class.extend function by John Resig: http://ejohn.org/blog/simple-javascript-inheritance/ This has been fine but I find myself writing numerous setters and getters that only get used on init. Also, it seems to lead to memory leaks in IE when storing instances of these objects i...

advanced rollover to display extra options

Hi, I have a web app that has a list of user comments. I want extra options for these comments (vote, reply, etc..) to appear only when the comment itself is mouseover-ed The best example of what I am looking for would be a youtube video: http://www.youtube.com/watch?v=s2VzLn6DMCE&ob=av3e When you go to the comments the options...

Does a document or guideline exist that covers the integration points required to add a framework to spring-js?

I've been looking into the spring-webflow/spring-js integration and can't seem to find a guide that describes what is required for implementing a js framework for spring. There is a default integration with dojo, but I'd like to see about integrating jQuery or Prototype and am unclear on what is needed to accomplish this. Thanks. ...

remove name from dynamically created hidden input

I have a div that is being duplicated dynamically. After duping it, I need to remove the name from the hidden input only, but can't seem to be able to select it only. The majority of the file is prototype, but I have jQuery at my disposal (jq). I have managed to get the name to disappear, but it clears them all out, I only want it clea...

Starting and stoping listeners in Mojo framework (WebOS)

Hi, I am starting WebOS dev and I have a doubt on where should I start and stop my listeners ? I am reading this book but I couldn't find a clear explanation about this. In the sample the author set the listeners in the setup function but I wonder why? isn't a better idea to set them in activate function and stop them in deactivate func...

Gmaps v3 Change style of MapTypeControlStyle DROPDOWN_MENU

Hi, Can someone help me to change the style of MapTypeControl DROPDOWN_MENU without needing to build a complete new one. I searching to preserve localisations using the Default dropdown in place to build my own not localised when load. Thanks. ...

Update a link href in prototype

Hey all, I'm running a prototype script (lightbox) and I want to add an extra link below each image with the url to a page that changes with each image. I have so far managed to add the a element to the right place, but later in the script I need to update the href of the link based on the image that is loaded. There's a point in the ...

Conflict with jQuery + Prototype + Opera / IE

Greetings, I'm using IPBoard CMS that comes with prototype and I use the latest jQuery. I've implemented a jQuery gallery picture viewer: - It works fine on Chrome and Firefox. - I have troubles with Opera and IE 8. I've created a minimal example here: http://www.warriorlabs.net/index.php?app=ccs&module=pages&section=pages&amp...

Why does window.innerWidth returns 477px even if the window has a smaller width?

When I resize the browser window to a lower width than 477px, window.innerWidth or window.getSize().x (using mootools) still returns 477px. Anyone ever had that problem? What's going on here? The problem occurs in Firefox and Chrome. ...

'this' is undefined in JavaScript class methods

I'm new to JavaScript. New as far as all I've really done with it is tweaked existing code and wrote small bits of jQuery. Now I'm attempting to write a "class" with attributes and methods, but I'm having trouble with the methods. My code: function Request(destination, stay_open) { this.state = "ready"; this.xhr = null; th...

Redbox not working with forms - alternative?

I've installed Redbox, a lightbox solution for rails. It works fine, but I'm trying to use it for a form. Part of the form is in my view, but part of the form and the submit button are in the box: <div id="confirm", style="display:none;"> Are you sure you want to go?<br><br> <%= f.check_box :...

What it the significance of the Javascript constructor property?

Trying to bend by head around Javascript's take on OO...and like many others running into confusion about the constructor property. In particular, what it's significance is as I cant seem to make it have any affect. E.g. function Foo(age) { this.age = age; } function Bar() { this.name = "baz"; } Bar.prototype = new Foo(42); ...

Using the CSS3 :not selector with IE - using Prototype

I need to add a CSS style to a content <div>, which is present on all pages of my site. However, I do not want to use the new style on the homepage. All the pages on the site have a similar structure: a header <div> with navigation bar, followed by a content <div> with the page's contents. Best I could think of is to add a wrapper div ...

$_POST is empty when using AJAX (Prototype)

Hi. I am fairly new to PHP and I am experiencing a problem that I can't find an answer to anywhere!! It really bugs me... I want to post data to a PHP script using AJAX. I am using the JS framework Prototype to do AJAX communication. Here is the JS code: new Ajax.Request("/ondemand/Radio.php", { method: 'POST', par...

jQuery AJAX help.

Hi All. I am new here, and I have looked at the other Ajax Help topics, however, I still can't see why mine isn't working. Here it is: $(document).ready(function(){ $.ajax({ type: "GET", url: "localhost/val.php", data: "val=RichieC", success: function(msg){ alert("WOO"); } }...

Prototype JS Framework - Calling a function when updates occur with a periodic updater.

How do I call a function on every update? Below is what I tried. It doesn't work. The function itself works fine when I execute it alone. new Ajax.PeriodicalUpdater('chatMessages', 'chat/receive_chat', { method: 'post', parameters: {lId: latestId}, insertion: Insertion.Bottom, ...