Ids are not allowed to begin with numbers. I think that's your whole 
issue here.

Walter

On Apr 26, 2007, at 12:58 PM, Tom V. wrote:

>
> Hi,
>
> my project (and problem) in a nutshell:
> the user is able to click a file system tree to select files.
> The content of those files is shown in a multi-tabbed pane.
> For each tab I want to create an IPE for editing the file.
> So I need unique IDs for each tab and IPE.
>
> my partial:
>
> <script type="text/javascript">
>   var contents = "<%= escape_javascript(h file_contents) %>";
>   var preId = now.getTime();     // Date Obj now defined in default
> layout
>   document.getElementById(tabbedIPEId).innerHTML = "<pre id=\""+preId
> +"\" class=\"sourcecode\" onclick=\"createEditor\("+preId+"\)
> \">"+contents+"<\/pre>";
> </script>
>
> 'tabbedIPEId' is a unique ID for each tab opened (i.e. 'filename.rb').
> the JS-function for the IPE makes use of the 'preId'-value:
>
> function createEditor(preId) {
>   //...
>   var editor = new Ajax.InPlaceEditor(preId, '<%=
> escape_javascript(url_for({ :action => "save_file"}))%>', {okText...
>   //...
> }
>
> Opening tabs just works fine, for each file I get the following html
> (simplified):
>
> <div id="filename.rb" class="classXYZ" style="display: block;">
>   <pre id="1177515282765" class="sourcecode"
> onclick="createEditor(1177515282765)">...file contents...</pre>
> </div>
>
> But when I click the <pre>-tag, Firebug yells at me:
>
> element.style has no properties
> getStyle(1177515282765, "backgroundColor")prototype.js (line 1536)
> initialize(1177515282765, "/ide/save_file", Object okText=save
> cols=164 rows=11)controls.js (line 519)
> create()prototype.js (line 34)
> createEditor(1177515282765)5 (line 73)
> onclick(click clientX=0, clientY=0)5 (line 1)
>
> [Break on this error] var value = element.style[style];
> http://prototypejs.org/api/element/getStyle
>
> Does it mean that the <pre>-tag has no properties?
>> From looking at the generated html-code I would say it does...
> Or does it have to do with "innerHTML"?
> What am I missing..?
>
> Cheers,
>   Tom.
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to