2017-05-17 44 views

回答

0

在JS:

var array = ["https://madeby.google.com/static/images/google_g_logo.svg","http://searchengineland.com/figz/wp-content/seloads/2015/12/google-amp-fast-speed-travel-ss-1920.jpg"] 
 
//whatever links you want 
 
function go(){ 
 
    var x = array[Math.floor(Math.random()*array.length)] 
 
    document.getElementById("hi").src=x 
 
}
 <button onclick="go()">start</button> 
 
     <img id="hi"></img>

相關問題