2016-05-25 5 views
-3

3つのタブを開くリンクを作成するように指示されました。私が作成したJavaScriptは、2つのタブのみを開きます。クリックするとWebブラウザの3タップが開きます

<div id="g_image2" style="position:absolute; overflow:hidden; left:760px; top:32px; width:149px; height:45px; z-index:49"> 
    <a href="javascript:{}" onClick="window.open('http://cent5.serverhostingcenter.com:2199/start/behyghgu/','radio_player', 'Width=82,Height=50,directories=0,hotkeys=0,location=0,menubar=0,personalbar=0,resizable=0,scrollbars=0,status=0,toolbar=0');"> 
    onClick="window.open('http://cent5.serverhostingcenter.com:2199/start/behyghgu/','radio_player', 'Width=82,Height=50,directories=0,hotkeys=0,location=0,menubar=0,personalbar=0,resizable=0,scrollbars=0,status=0,toolbar=0');"> 

    <img src="images/Fm101 banner.png" alt="" title="" border=0 width=145 height=43></a> 
</div> 
+2

機能を使用します。ここでは、コードです。 [質問の仕方](http://stackoverflow.com/help/how-to-ask)と他のjavascriptに関する質問をここで取り、あなたの質問にできるだけ多くの情報を提供しようとします。 – Niklas

+0

あなたの質問は間違ってフォーマットされていますが、私はあなたが何をしようとしているのかちょっと見ることができます。別のスクリプトタグやJSファイルを作成してそこにコードを書くのはなぜですか? – evolutionxbox

答えて

1

あなたはこのような疑問を持つ多くの助けを得ることはありません

window.onload=function() { 
 
    document.getElementById("playerlink").onclick=function(e) { 
 
    e = e?e:window.event; 
 
    e.preventDefault(); 
 
    var w, 
 
     vid = this.getAttribute("data-vid").split(","), 
 
     preFix = "http://cent5.serverhostingcenter.com:2199/start/"; 
 
    for (var i=0;i<vid.length;i++) { 
 
     w = window.open(preFix+vid[i],"player_"+i,"width=82,height=50,resizable=0"); 
 
    } 
 
    if (w == null) { 
 
     alert("Please allow popups"); 
 
    } 
 
    } 
 
}
<a href="pleaseturnonjs.html" id="playerlink" data-vid="behyghgu,behyghga,behyghgb">Click</a>

関連する問題