1. 程式人生 > >document.write中輸出html標簽用法

document.write中輸出html標簽用法

網頁 document bsp eight 繼續 lac idt -a wid

輸出HTML標簽,只需將標簽寫入雙引號:

示例:在網頁中輸出<p>革命還在繼續</p>

document.write("<p style=‘border:1px solid black;width:300px;height:90px;

line-height:90px;background:#abcdef;text-align:center;‘> 我愛學習</p>");


註意:

連接字符串,用加號"+";

字符串用雙引號""括起來。

document.write中輸出html標簽用法