CodePen

HTML

            
               <script>
<!--
/*
Random link button- By JavaScript Kit (http://javascriptkit.com)
Over 300+ free scripts!
This credit MUST stay intact for use
*/

//specify random links below. You can have as many as you want
var randomlinks=new Array()

randomlinks[0]="http://freewarejava.com"
randomlinks[1]="http://javascriptkit.com"
randomlinks[2]="http://dynamicdrive.com"
randomlinks[3]="http://cnn.com"
randomlinks[4]="http://www.geocities.com"

function randomlink(){
window.location=randomlinks[Math.floor(Math.random()*randomlinks.length)]
}
//-->
</script>


<!--Uncomment below to use a regular text link instead
<a href="javascript:randomlink()">Random Link</a>
-->

<form>
<input type="button" name="B1" id="random" src="img/card3.png" value=" " onclick="randomlink()"> </form>
            
          
!
via HTML Inspector

CSS

            
              #random
{
  display: block;
 position:absolute;
  width: 200px;
  height: 100px;
  background-image: url("http://drupal.org/files/project-images/php.png");
    border:none;
}
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................