class is a reserved keyword. use 'class' or className instead. Best,
Tobie elduderino wrote: > hi, > > I have a script written using prototype at this page: > > http://boudaki.com/replace/replace/replacy.php > > It works fine in firefix but in IE6 i get a error....it says expected > identifier,string or number on line 11.....when i open the microsoft > script debugger it doesn't point to any line in particular. ( it > usually flags the code in fault up with a big yellow arrow) I cant > spot the problem...could anyone suggest what it is? > > Heres the code...line 11 seems to be where i'm creating the a tag with > a class of select element: > > //replace out the selects for un-ordered lists once the dom is fully > loaded > document.observe("dom:loaded", function() { > var forms = $$('select'); > var container = $('select_container'); > forms.each(function(select, index) { > select.hide(); > var ul = new Element('ul', { id: 'list_' + (index +1) + '_body'}); > var options = select.select("option"); > options.each(function(option) { > if(option.selected == true) { > var aTag = new Element('a', { id: 'list_' + (index +1), class: > 'selectelement', href:'#' }).update(option.innerHTML); > container.appendChild(aTag); > } > var li = new Element('li'); > var anchor = new Element('a', {class: > 'listelement'}).update(option.innerHTML); > li.appendChild(anchor); > ul.appendChild(li); > container.appendChild(ul); > ul.hide(); > }); > }) > > //now deal with the clicks > document.observe("click", function(event) { > var id = event.element().id; > var idd = event.element().className; > if(idd != 'selectelement') { > var all = $$("[id^=list_][id$=_body]"); > all.each(function(eachselect) { > eachselect.hide(); > }) > } > var searchid = id.indexOf('list_'); > if(searchid != -1) { > var assocList = id + '_body'; > var listy = $(assocList); > listy.toggle(); > } > if(event.element().hasClassName('listelement') || > event.element().hasClassName('listyy')) { > event.element().className = 'listyy'; > var txt = event.element().firstChild.nodeValue; > var parentSelect = event.element().up(1).id; > var getselecthead = parentSelect.replace('_body',''); > var yeah = $(getselecthead); > yeah.update(txt); > var number = getselecthead.replace('list_', ''); > var listhead = $$(getselecthead); > var selects = $$('select'); > selects.each(function(list, index) { > if(index == (number -1)) { > var opt = list.select("option"); > opt.each(function(option) { > if(option.innerHTML == txt) { > option.selected = true; > } > }) > } > }) > } > > var tot = $$('a.listelement'); > tot.each(function(lf) { > lf.observe('mouseover', function(event){ > var parentSelect = event.element().up(1); > var listelements = parentSelect.select('a'); > listelements.each(function(isit) { > if(isit.className == 'listyy') { > isit.className = 'listelement'; > } > }) > }) > }); > }) > }) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
