第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

使用動(dòng)態(tài) URL 創(chuàng)建動(dòng)態(tài)數(shù)量的按鈕

使用動(dòng)態(tài) URL 創(chuàng)建動(dòng)態(tài)數(shù)量的按鈕

我覺(jué)得離這個(gè)很近。我只是無(wú)法在新選項(xiàng)卡中打開(kāi)生成的按鈕。我被卡住了!     function buildButton(url,i,size) {            document.write("Building Button with URL= "+url+"<p>");            var btn = document.createElement("BUTTON");            btn.appendChild(document.createTextNode("PIDs "+i+" to "+(i+size)));            btn.setAttribute("href",url);            btn.setAttribute("target","_blank");            document.body.appendChild(btn);}
查看完整描述

3 回答

?
拉丁的傳說(shuō)

TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超8個(gè)贊

將<button>標(biāo)簽更改為<a>標(biāo)簽


按鈕沒(méi)有href和target屬性,<a>標(biāo)簽有。代碼應(yīng)該是這樣的:


function buildButton(url,i,size) {

  document.write("Building Button with URL= "+url+"<p>");


  var a = document.createElement("a");

  a.appendChild(document.createTextNode("PIDs "+i+" to "+(i+size)));

  a.setAttribute("href",url);

  a.setAttribute("target","_blank");

  document.body.appendChild(a);

}


buildButton('https://stackoverflow.com/', 1, 1);

<!DOCTYPE html>

<html>

<body>


</body>

</html>


查看完整回答
反對(duì) 回復(fù) 2021-12-23
?
心有法竹

TA貢獻(xiàn)1866條經(jīng)驗(yàn) 獲得超5個(gè)贊

解決了它:


function buildButton(url,i,size) {

    var btn = document.createElement("INPUT");

    btn.setAttribute("type","button");

    btn.setAttribute("onclick", "window.open('"+url+"')");

    btn.setAttribute("value","PIDs "+i+" to "+(i+size));

    btn.setAttribute("target","_blank");

    document.body.appendChild(btn);

    document.write("<p>");


查看完整回答
反對(duì) 回復(fù) 2021-12-23
?
吃雞游戲

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超7個(gè)贊

另一個(gè)基于此HTML 按鈕在新選項(xiàng)卡中打開(kāi)鏈接的解決方案??雌饋?lái)你已經(jīng)想通了


function buildButton(url,i,size) {

    document.write("Building Button with URL= "+url+"<p>");


    var btn = document.createElement("button");

    btn.appendChild(document.createTextNode("PIDs "+i+" to "+(i+size)));

    btn.setAttribute("onclick","window.open('" +url+"', '_blank')");


    document.body.appendChild(btn);

}  

buildButton("http://www.google.com","Thing", 44) ;


查看完整回答
反對(duì) 回復(fù) 2021-12-23
  • 3 回答
  • 0 關(guān)注
  • 167 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)