prototype

Source control structure for prototype and real implementation

How should we structure a project in source control with prototype + 'real' implementation of the application? We work on a prototype for a new project and store that in source control (Subversion, but the question should be independent of that) with the following structure in our main repository with all our projects: [ProjectName]/ ...

Javascript Event Hierarchy in Prototype framework

Hi there, is there any event to be handled between the dom:loaded and load using Prototype javascript framework? I've implemented a preloader using prototype which is looking like this: Event.observe(window,"load",preload); function preload(){ if($('wrapper')) $('wrapper').setStyle({"display":"block"}); if($('loading')) ...

Looping through all select elements with JavaScript Prototype library

How can I (if it is possible) use the Prototype library to loop through all select elements on a page and access the element? In the documentation I found easily shortcuts for referencing elements with certain ids, class names etc. but no reference for elements with certain tag names. If this is not possible with Prototype, an example w...

IE 7 error writing to a document

Hi all, I am using the prototype JavaScript library to read the contents of a text area (which is often the complete mark-up for another HTML page), create a new window and then set the new window content to be that same mark-up, like so: var htmlContent = $("msHTML").value; var win = window.open("preview.cfm", "Preview HTML", "left=2...

Javascript class variable scope using prototype

Hi I'm writing a basic class using prototype.js in which some class vars are set when the class is initialised - the problem is that these variables aren't available to other methods within the class. var Session = Class.create({ initialize: function(){ // define defaults this.source = ''; }, shout: function(){ alert(this.source); }...

Get form elements by name?

I would like to style all of the radio buttons with the same name in a form easily in a nice Prototype or jQuery-style shortcut. $('billship').select('name:shipType') or something like that. Does such a shortcut for form field names exist? ...

Jquery: Filter dropdown list as you type

I have used a prototype plugin which filters the contents of a dropdown as you type. So for example if you typed 'cat' into the text box, only items containing the substring 'cat' would be left as options in the drop down. Does anyone know of a jquery plugin which can do this? ...

Javascript 'Namespaces' and jQuery AJAX

I'm using the recommendations laid down here (http://www.odetocode.com/articles/473.aspx) to write a JavaScript AJAX webchat system using simulated Namespacing and prototyping. In one of my prototype methods I'm calling the $.ajax method in jQuery. What I then want to do is pass the returned JSON data into a method inside my JavaScript ...

What tools do you use to create prototypes or mockups of webservices?

Ideally, and you will think I am crazy, I can code some basic logic into a bash or korn script and open that functionality up to clients hitting them. There is a lot of plumbing involved in web services and I was wondering what tools and techniques more experienced developers have been using to prototype systems where a backend webservi...

C : differences between prototype declaration in header and function declaration for implementation?

I was wondering about little differences between declaration of function prototypes in headers and in .c files. I have a header with some prototype functions and a some .c files with real implementation of these functions. I made some changes in the header, only added "__restrict" qualifier (recognized by gcc). My question is do I have t...

How do I dynamically load a js file using Prototype?

Hello, I am using prototype to load external js file (actually it is php file) dynamically. Like this: function UpdateJS(file) { var url = 'main_js.php?file='+file; var myAjax = new Ajax.Request( url, {method: 'get', onComplete: showResponseHeader} ); } function showResponseHeader (originalRequest) { $('jscode').innerHTML = o...

Web UI prototyping tools

Can anyone recomend me a simple web UI prototyping tool, so I could quicky prototype the look of a my web site. I have tried to use MS Visio for this, but found it very "user un-friendly". What I really need is to be able quicky sketch the layout of the page, put some links, images and buttons on in, play a little bit with a colors (C...

How can I keep my AJAX call from posting back to the server when using Prototype?

I am trying to keep my AJAX call from posting back to the server when using Prototype. Code: echo " <a href='my.php?action=show&amp;id=".$fid."' onclick=\"return display('".$fid."');\"> "; echo "" .$fname."</a> "; How can I do this? ...

floating bar javascript (prototype or scriptaculous)

Hey everyone. I'm looking for a horizontal bar that scrolls with the page, ideally implemented in prototype or scriptaculous. I want it to be exactly like the bar shown to first time usersof stackoverflow telling them about the FAQs. Thanks. ...

Overwriten "this" variable problem or how to call a member function?

I have this class where I am using a combination of jQuery and prototype: var MyClass = Class.create({ initElements: function(sumEl) { this.sumEl = sumEl; sumEl.keyup(this.updateSumHandler); }, updateSumHandler: function(event) { // Throws error here: "this.updateSum is not a function" this.updateSum(); }, updateSum: funct...

Prototype select all checkboxes code works in IE, but not Firefox

I'm using prototype 1.6.0.1. I'm trying to select all the checkboxes when clicking a button. This code works in IE 6, but does NOT in Firefox 3. What am I doing wrong? <input class="submit" type="button" value="check all" onclick="$(this.form).getInputs('checkbox').each(function (elem) {elem.checked = true;});" /> ...

BindAsEventListener equivalent in jQuery?

I am trying to bind a click event to some element using jQuery. Using prototype I know I can do this using BindAsEventListener(). Example: var myObject = { init: function(txtOneId, txtTwoId, lblResultId, ancAddId) { this.txtOneId = txtOneId; this.txtTwoId = txtTwoId; this.lblResultId = lblResultId; this.ancAddId = an...

Prototype's Ajax.Updater not actually updating on IE7.

I am trying to submit a form using Ajax.Updater and have the result of that update a div element in my page. Everything works great in IE6, FF3, Chrome and Opera. However, In IE7 it sporadically works, but more often than not, it just doesn't seem to do anything. Here's the javascript: function testcaseHistoryUpdate(testcase, form) { ...

Most efficient way to determine if an HTML element is in the viewport?

I'm currently using prototype, with some code like: function in_viewport(foo) { var offset = foo.viewportOffset().top; var viewportHeight = document.viewport.getHeight(); if (offset > (0 - foo.getHeight()) && offset < viewportHeight) { return true; } else { return false; } } Is there a faster/easier/more-efficient/be...

JavaScript prototype function not overriding the original one

Learning javascript when I came across the concept of prototype. I succeeded in adding new methods to the cat class but failed in overriding the original talk method. function cat(name) { this.name = name; this.talk = function() { alert( this.name + " : I'm a girl!" ) } } cat.prototype.talk = function() { alert( th...