<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>無標題文檔</title></head><body><script type="text/javascript">var main = document.body;//創(chuàng)建鏈接function createa(url,text){? ? var btn = document.createElement("input");? ? btn.type="button";? ? btn.value=text;? ? btn.style.color="red";? ? btn.style.backgroundColor="gold";? ?// btn.setAttribute("onclick",window.open(url)); ? 就是這一行,我的意思是,點擊按鈕,然后把外面的值傳進來,可是把window.open(),“ ”起來的時候,值就傳不進去了 該咋整? ? return btn;}main.appendChild(createa("http://idcbgp.cn","慕課網(wǎng)"));</script>?</body></html>
新手,求指教!關(guān)于JS中的一些問題
if_else_
2016-04-28 21:15:11