Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Javascript and I have different ideas about what "concatenate" means.



Strange, I this is my code:

<html>
 <head>
  <script>
function display_result(){

  output = "";
  for (num=0;num<2;num++)
  {
    output = output.concat('<div id="1">\n<div id="2">\n<div
id="3">\n</div>\n</div>\n</div>\n');
  }
  alert(output);

}
  </script>
 </head>
 <body>
  <form onsubmit="display_result()">
   <input type="checkbox" id="check">
   <input type="submit" />
  </form>
 </body>
</html>

And this is my result:

<div id="1">
<div id="2">
<div id="3">
</div>
</div>
</div>
<div id="1">
<div id="2">
<div id="3">
</div>
</div>
</div>

Which is the supposed output. I used Firefox and Chrome to execute the script.

Do you have previous definitions of output?


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links