javascript中的按鈕問題
?
?我定義函數(shù)function contxt()?{alert("哈哈,調(diào)用函數(shù)了!");?}???1和2的區(qū)別是什么?請(qǐng)?jiān)敿?xì)一點(diǎn)1.<form>?<input type="button"? value="點(diǎn)擊我" onclick="contxt()" /> </form>
?
2.<button type="button" onclick="contxt()">點(diǎn)擊我</button>
2016-02-23
1和2的實(shí)際效果是完全一樣的。
在?button?元素內(nèi)部,可以放置文本或圖像。這是<button>與使用?input?元素創(chuàng)建的按鈕的不同之處。
你可以給button內(nèi)添加圖片內(nèi)容,2中并沒有添加。