Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Prototype: Update with multiple elements and texts

Reply
Thread Tools

Prototype: Update with multiple elements and texts

 
 
Daniel Loose
Guest
Posts: n/a
 
      06-04-2008
Hi,

I am new to prototype.js and appreciate it a lot.

One simple thing however seems to be impossible? I have a <td> element
which I want to fill with
- an input field
- text
- another input field

at one step.

i.e.
td = ... (simply the <td> element)
in1 = new Element('input', ...)
in2 = new Element('input', ...)

Now none of these works: (because in some cases, the element itself is
printed, not its content)

td.update(in1).update(td.innerHTML + 'bla').update(td.innerHTML + in2)

td.update(in1 + 'bla' + in2)

td.update(in1.innerHTML + 'bla' + in2.innerHTML)

....so what *does* it?

(or simply: how do I get the content of a new, not-yet-written,
element?)

Thx!


*************

Marty - it's perfect! You're just not thinking fourth dimensionally!
[Emmett "Doc" Brown]

If you wish to email me, please use newsreply at wuwei minus webservices dot de
 
Reply With Quote
 
 
 
 
Keith Hughitt
Guest
Posts: n/a
 
      06-04-2008
Hi Marty,

If you are using script.aculo.us, try checking out Builder.node and
Builder.build. Using Builder.node
you can do things like:

var td = Builder.node ('td', {style: '...'},
[Builder.node('input', ...), Builder.node('input',...), 'some plain
text, etc.']);

and Builder.build can even acccept entire xhtml fragments.


On Jun 4, 10:14*am, Daniel Loose <gruenwiesl...@web.de> wrote:
> Hi,
>
> I am new to prototype.js and appreciate it a lot.
>
> One simple thing however seems to be impossible? I have a <td> element
> which I want to fill with
> - an input field
> - text
> - another input field
>
> at one step.
>
> i.e.
> td = ... (simply the <td> element)
> in1 = new Element('input', ...)
> in2 = new Element('input', ...)
>
> Now none of these works: (because in some cases, the element itself is
> printed, not its content)
>
> td.update(in1).update(td.innerHTML + 'bla').update(td.innerHTML + in2)
>
> td.update(in1 + 'bla' + in2)
>
> td.update(in1.innerHTML + 'bla' + in2.innerHTML)
>
> ...so what *does* it?
>
> (or simply: how do I get the content of a new, not-yet-written,
> element?)
>
> Thx!
>
> *************
>
> Marty - it's perfect! You're just not thinking fourth dimensionally!
> [Emmett "Doc" Brown]
>
> If you wish to email me, please use newsreply at wuwei minus webservices dot de


 
Reply With Quote
 
 
 
 
jdalton
Guest
Posts: n/a
 
      06-05-2008
The Prototype mailing list: http://groups-beta.google.com/group/...rails-spinoffs

//probably the easiest way
$('myTD').insert('Phone number: <input type="text" name="areacode"
maxlength="3" /> - <input type="text" name="phonenumber" />');

- JDD
 
Reply With Quote
 
dhtml
Guest
Posts: n/a
 
      06-05-2008
On Jun 4, 7:14 am, Daniel Loose <gruenwiesl...@web.de> wrote:

>
> One simple thing however seems to be impossible? I have a <td> element
> which I want to fill with
> - an input field
> - text
> - another input field
>
> at one step.
>


What is wrong with innerHTML?

> Thx!

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      06-05-2008
Daniel Loose wrote:
> I am new to prototype.js and appreciate it a lot.


I am not and I do not. Exactly because you are new to it you are in no
position to assess its quality. Prototype.js is considered junk around here.

> One simple thing however seems to be impossible? I have a <td> element
> which I want to fill with
> - an input field
> - text
> - another input field
>
> at one step.
>
> i.e.
> td = ... (simply the <td> element)
> in1 = new Element('input', ...)
> in2 = new Element('input', ...)


The declaration for the Element constructor would overwrite the object built
into Gecko-based UAs. At least it would attempt to, we are talking host
objects here.

> Now none of these works: (because in some cases, the element itself is
> printed, not its content)
>
> td.update(in1).update(td.innerHTML + 'bla').update(td.innerHTML + in2)
>
> td.update(in1 + 'bla' + in2)
>
> td.update(in1.innerHTML + 'bla' + in2.innerHTML)
>
> ...so what *does* it?
>
> (or simply: how do I get the content of a new, not-yet-written,
> element?)


A new element does not yet have content. `input' elements in particular
always have EMPTY content, or no content at all if you will.

> [...]
> If you wish to email me, please use newsreply at wuwei minus webservices dot de


There is the Reply-To header for this.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A defined entity applying in multiple SVG texts in a document. peasthope@shaw.ca XML 1 11-30-2008 07:06 PM
Calendar control and title texts jonas@vinninge.com ASP .Net 0 12-16-2006 07:25 AM
Recommended reference texts for Verilog and VHDL hdl_book_seller VHDL 0 01-03-2005 04:52 PM
Books, books, books: best reference texts for Verilog and VHDL HDL Book Seller VHDL 0 12-01-2004 02:26 AM
show images and texts in datagrid or other server controls masoud ASP .Net 3 07-11-2004 11:21 PM



Advertisments