<img src="code.png" onclick="this.src ={$maccms.path_tpl}picture/captcha.png"
<script>var ranNum = Math.floor(Math.random()*4) //随机一个0到3的数
var imgArr = ['6.jpg','7.jpg','8.jpg','9.jpg']//存放图片路径
document.getElementsByTagName('img')[0].setAttribute('src',imgArr[ranNum])
</script>