Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31699

Re: How to send dynamically generated document elements to a server side script for data saving?

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: How to send dynamically generated document elements to a server side script for data saving?
Date 2016-11-11 16:29 +0100
Organization PointedEars Software (PES)
Message-ID <1767224.PIDvDuAF1L@PointedEars.de> (permalink)
References <ba091100-dbad-4f5e-9e2d-ddee43398287@googlegroups.com> <1fkka1wzfld0h$.h1uvn3rxzhzz.dlg@40tude.net>

Show all headers | View raw


JJ wrote:

> On Thu, 10 Nov 2016 17:45:24 -0800 (PST), justaguy wrote:
>> What I intend to do:
>> The page allows the user to add dynamic elements (and some of such
>> elements would automatically have an image file associated with it). that
>> is, it allows a user to document.createElement('span') etc.
>> 
>> I then, have a function to map all the document elements to a FORM
>> element, specifically a Textarea tag with an id and name.
>> 
>> Problem:
>> I'm getting objects, instead of objects properties.
>> See below
>> [object HTMLHtmlElement][object HTMLHeadElement][object
>> [HTMLScriptElement]
>> ....
>> So, what do I need to do to make it happen?
>> 
>> Thanks.
> 
> That's because an element object won't become a HTML code string when the
> object is converted to string. You need to use its outerHTML property if
> you want its HTML code.

However, this wish is probably based on a flawed approach as the attributes 
of the element, and its descendants and their attributes, are available as 
and via properties in the document tree.  By contrast, serialization of 
element objects using the “outerHTML” property will rarely yield appropriate 
results, as it will yield results that you have no control over (unless you 
parse them again, but then why did you serialize in the first place?).

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-10 17:45 -0800
  Re: How to send dynamically generated document elements to a server side script for data saving? JJ <jj4public@vfemail.net> - 2016-11-11 21:43 +0700
    Re: How to send dynamically generated document elements to a server side script for data saving? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-11-11 16:29 +0100
      Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 11:39 -0800
      Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 11:39 -0800
        Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 12:12 -0800
          Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 12:28 -0800
    Re: How to send dynamically generated document elements to a server side script for data saving? justaguy <lichunshen84@gmail.com> - 2016-11-11 11:38 -0800

csiph-web