tableタグをカンマ区切りで記述するJS
<html> <body> <script> function tr(td){ document.write("<tr><td>"+td.replace(/^\s+|\s+$/g,'').replace(/\s*,\s*/g,',').split(",").join("</td><td>")+"</td></tr>");} </script> <table border=1><script> tr("abc,def,ghi,jkl,mno"); tr("123,456,789,012,345"); </script></table> </body> </html> |