prototype

CSS/JavaScript: get user-visible text of an element

Suppose I have the following HTML: <div id="test"> <span style="display:inline;">foo</span> <span style="display:none;">bar</span> <span style="display:inline;">baz</span> </div> .. is there some way in JavaScript for me to get the output "foo baz" (not "foo bar baz")? $('test').textContent returns the latter, and innerHTML doe...

Prototype focusFirstElement() causes form to 'disappear' in IE

Strange bug I'm getting. I have a login form that is hidden by default, once a user clicks on an observed element, the element containing the form slides down (using Effect.BlidnDown in Scriptaculous) Here is the function, which is part of the 'Interface' object: revealLoginForm: function() { $('a_login').blur(); if (!$('hform'...

Event.observe 'change' events not being triggered in IE

The Prototype event listener I use for changes in select menus is not being triggered in IE. Event.observe('use_billing', 'change', Checkout.getBillingData); This works fine in Firefox (of course), but nothing happens in IE (of course) - I've been Googling this for some time, but I have not found a suitable solution to this problem. I...

Hide/Show <div> according to URL in Prototype

Hi Guys, I am trying to use the prototype framework to hide a '< div >' based on a particular URL. I don't have access to server side - so I have no choice but to do this using prototype [restriction of platform using prototype]. Wondering if someone could tell me how to do this in prototype framework ? i.e. I tried to do this but doe...

Prototype find element and only perform if found

Hi Guys, Struggling a little here with prototype = I've created this function Event.observe(window, 'load', function() { if ($$('#test li:first')!=null) { $('test').down('li').down('a').update('Test'); } }); Basically, it works on pages where #test li:first is found but on pages it isn't it returns $("test").down("li") is undef...

Prototype find class and replace text

Hi Guys, I am using the prototype framework [requirement by platform] and I am trying to find a ID and replace some text in the ID so that it disappears. The HTML looks like: <div id="top"> <a href="/login">login</a> | <a href="/register">register</a> </div> The problem is I don't want the " | " to appear in the ID "top". So I guess...

Find and Replace Text with Prototype

I am new to Prototype and was wondering how to simply "find" some text in a class/ID and "replace" this text. My html is like this: <div id="test"> <a href="/test">test</a> <a href="/test2">test2</a> <a href="/test3">test3</a> <a href="/test4">test4</a> </div> And I am trying to replace the "test" in between the <a> tags for ...

Prototype Rounded Corners

Hi Guys, I am using http://nurey.com/corners.html with Prototype framework and trying to get some rounded corner action happening. However, the script I am using Event.observe(window, 'load', function() { if($$('header')!=null) { $('header').Effect.Corner("5px"); } }); Doesn't appear to actually make the corners work ? Can a...

CurvyCorners Error

Hi Guys, I am using this code with http://www.curvycorners.net/instructions/. Everytime I use it I seem to be getting var curvyCornersVerbose = false; Event.observe(window, 'load', function() { var settings = { tl: { radius: 5 }, tr: { radius: 5 }, bl: { radius: 5 }, br: { radius: 5 }, antiAlias: tru...

observer does not work in IE

In my ruby on rails app I am trying to use a Prototype Form.Element.Observer to run a count of the characters in a message. This works fine on Firefox/Safari/Chrome, but not on IE. On IE the observer simply does not fire. Is there a fix or a different way of doing this? My ruby tag looks like this: <%= countdown_field('txtmsg[memo]'...

Simple Horizontal Javascript Navigation with Prototype

I'm trying to implement a simple horizontal navigation menu that just shows a single div for each link. It is kinda like a dropdown menu but instead of a mouseover triggering a dropdown, an onclick event will trigger the showing of a div. I want to make sure I am taking the right approach before going too much further, any help is appr...

Prototype missing : after element

Hi Guys, I am using this script in prototype Event.observe(window, 'load', function() { $('li.home').setStyle({ padding-top: '10px' }); }); And it gives me the error missing : after property id padding-top: '10px'\n Not really sure what I am doing wrong ? ...

Element.insert at bottom-1 with prototype

Hi, I want to insert an Element at the position bottom -1 of his parent. The following code insert at the bottom el.insert({bottom: content}) thanks ...

jQuery .NoConflict Script Load

Hi Guys, I am trying to use jQuery in a highly conflict environment. .noConflict() doesn't work and I am trying to do something like <script type="text/javascript"> document.write( document.write(unescape("%3Cscript src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'%3E%3C/script%3E")); jQuer...

Insert Script into Head using Prototype

Hi Guys, I am trying to insert jQuery into the head of a page using prototype but not entirely sure how to achieve this. Basically, I want the jQuery to appear AFTER the first tag in the head ? var script_head = document.createElement('script'); script_head.type = "text/javascript"; script_head.src = "http://ajax.googleapis.com/ajax/...

Prototype equivalent for jQuery closest function

Hi Is there any equivalent in Prototype for the jQuery closest function? http://api.jquery.com/closest/ thanks ...

how do I catch a click outside some container using prototype

document.observe('click', function(e, el) { if (e.target != Element.descendantOf('calendar')) { $('calendar').fade(); } }); I am trying to do something when a click is registered outside a certain container. In my code above, it's the $('calendar'). The above doesn't work. ...

How do I convert this snippet to Mootools

I have a Prototype snippet here that I really want to see converted into Mootools. document.observe('click', function(e, el) { if ( ! e.target.descendantOf('calendar')) { Effect.toggle('calendar', 'appear', {duration: 0.4}); } }); The snippet catches clicks and if it clicks outside the container $('calendar') should to...

Event Bubbling with Prototype

I have written a news scroller which uses the Prototype and Script.aculo.us libraries to scroll through the news feed at a set interval. There are buttons included in each news item that allow the user to manually scroll the news feed up or down manually. When the page is loaded the buttons are assigned event handlers for when they are c...

jQuery + Superfish + Supersubs + Prototype + IE = FAIL!

I am using the Superfish menu plugin for jQuery to display a vertical menu on some pages. I am also using the Supersubs.js plugin to make sure each level in the menu system is as wide as the widest LI element. I have taken the EXAMPLE.HTML file that is included in the download zip file and simply added the prototype.js library to the s...