Just a thought, will this way of web server work? I have some positive results

I am trying to make an arduino web server. It will serve both static information and dynamic values, with forms to acquire input from users. I started with a sample code. Something like a bunch of print strings and values. To say Amy is 8 years old would involve fragmented information such as
client.print (" is ")
client.print(" years old.")

What a hazard to try to change it into such as The 8 year old girl turns out to be Amy.

So I was thinking maybe use JavaScript to render values on client side. This way we start with a clean non fragmented sentence and a few blocks, such as box1 is box2 years old. It is easy to redo the sentence, just rearrange the boxes with the rest of the content. Right?

Now, I found a way, to use text inputs as the boxes, then assign their values with JavaScript so the static information box1 is box2 years old is separate from the actual values and no more fragments. It works nicely. I wanted to not use text input in some places but straight texts. I am not good with HTML dom model so I can't figure out how:

I want some text, maybe p or div node? How do I modify its content?




How do I change the text 1.25 into say 3.14 in JavaScript?

If I can do this, I can achieve separation of static and dynamic content. Thanks.

So my turn to answer my own question again!

I found this reference: