[Phpwm] Javascript / IE / prototype issues.

Greg Jones greg.jones at gmail.com
Fri May 25 19:20:37 BST 2007


If I have some time tomorrow, I will give a longer answer if you're still  
wanting one, but a couple of your points are quick:

On Fri, 25 May 2007 17:45:52 +0100, Paul Matthews  
<paul.matthews.86 at gmail.com> wrote:


> 1) There's no HTML Object to HTML code, though innerHTML is close, it's  
> not
> the entirely there.
> 2) all of prototype's DOM insert methods take in html strings (and use
> string id's for inserting before / after / above / down).

I very rarely use Insertion.X as they're not much use. If you're using  
scriptaculous already, then Builder.node() is useful (you could just use  
the Builder.js part). Prototype has code in SVN for 'var div = new  
Element('div',{className:'some_class',id:'some_id'});' if using that's an  
option. It looks nice, but haven't tried it yet myself.

> 3) When I've tried to use the methods with innerHTML I've got from other
> objects, nothing happens.
> 4) IE seems to not like innerHTML very much, I've come across a lot of
> problems, trying to do it, of course none of the errors are helpful  
> either.



> 5) When trying to clone the objects for obj.appendChild(cloned_obj), the
> objects are shallow cloned, which to all intents and purposes is  
> pointless!

passing 'true' to cloneNode() should cause it to do a deep copy.

> 6) I can't seem to appendChild() on a select element with option  
> elements,
> god knows why but even Firefox doesn't like that one, it gives an error  
> 'Node
> cannot be inserted at the specified point in the hierarchy" code: "3'

I tend to add option-nodes to the options array of the select:

$('select_id').options[$('select_id').options.length]=new_option;

I seem to remember a time when adding the options to the select, before  
the select is added to the document worked, when the other way round didn't


If you want to include/paste-bin the html of the table you're using, then  
if (when) I get bored tomorrow, I can check that what I reply with  
actually works :)

Greg


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the Phpwm mailing list