Javascript html adding extra lines of text with onclick -


I basically have a main title & lt; H1 & gt; and I have selected this one new additional line from my array so that the line is & lt; P1 & gt; Added at the end of Right now, when I click on the title, then I begin to be able to add a string under my head. But how can I make it so that the string is & lt; P1 & gt; To be added at the end of . & lt; P1 & gt; The first row of the story is considered and every time I & lt; H1 & gt; , then an additional line of the story will be added.

  & lt; Html & gt; & Lt; Top & gt; & Lt; / Head & gt; & Lt; Style & gt; # Canvas {margin: 5px; Padding 5px; Background: green; Limit: 1px solid black; } & Lt; / Style & gt; & Lt; Script & gt; Var maFonction = function (elem, event, couleur) {elem.style.color = couleur; } Insert insertText = function (text) {var elem = text; Elem.innerHTML + = Text; } Var newtable = new array (); Newtable [0] = "salut"; Newtable [1] = "goodbye"; Newtable [2] = "hey"; Var clickSurSection2 = Function (NewTable, Element) {for (var i = 0; i & lt; newtable.length; i ++) {element.inner html + = "& gt; Novew mot:" + Newtable [i]; }} & Lt; / Script & gt; & Lt; Body & gt; & Lt; H1 onmouseover = "mafone (this, incident, 'red');" Onmouseout = "maFonction (this, incident, 'blue');" Onclick = "click Sourcing 2 (NewTable, this);" Cleese Moe Dell en Esovir Plus & lt; / H1> & Lt; P1 & gt; Jane Marerson of the United Nations vivait dans une petite village dans la montagne & Lt; / Br & gt; & Lt; / P1> & Lt; Canvas id = "canvas" width = "600" height = "300" & gt; & Lt; / Canvas & gt; & Lt; / Body & gt; & Lt; Html & gt; 
"post-text" itemprop = "text">

you can wrap your story

Add elements to a div, and then finally add new lines:

  & lt; Div id = "story" & gt; & Lt; P1 & gt; United States Jane Marjan Vevient Dans is a patent village by Dans La Montgene. & Lt; / P1> & Lt; / Div & gt; Then, the script will be:  
  document.getElementById ("story"). Internal HTML + = "& br> Nouveau Mot:" + newtable [line];   

demo

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -