i'm trying to have two links on one page that each have a different set of variable urls. i can only get one of the links to work my code looks like this:
<script type="text/javascript">
var url=[
'bear52.html',
'bear53.html'
];
window.onload=function()
{document.getElementById('trig').onclick=function(){
location.href=url[Math.floor(Math.random()*url.length)];}}
</script>
<a href="#" id="trig">
YOU OKAY?</a>
<BR><script type="text/javascript">
var url=[
'bear30a.html',
'bear31a.html'
];
window.onload=function()
{document.getElementById('trig').onclick=function(){
location.href=url[Math.floor(Math.random()*url.length)];}}
</script>
<a href="#" id="trig">
RUN AWAY</a>
any help?
Aucun commentaire:
Enregistrer un commentaire