December 13, 201114 yr Hi Guys Can anyone help me with an issue I have; On my website I have 6 CSS Sprite buttons which link to external websites. I was wondering is there anyway I can introduce 2 checkboxes when either is selected and the user presses one of the buttons it goes to a different website or page? I don't know anything about Javascript, but I assume it will have to be used here as well as some kind of form I assume? A friend of mine wrote some Javascript for me, but he never told me where to put it or how to string it together, if anyone of u kind folks can decipher it, here it is: document.getElementById('gotoform').addEventListener('submit', function(e) { for (var goto = '', i = 0; i < this.goto.length; i++) { if (this.goto[i].checked) { goto = this.goto[i].value; break; } } if (goto === 'admin') { document.location = 'admin.php'; } else if (goto === 'home') { document.location = 'index.php'; } else { alert('Invalid input'); } e.preventDefault(); }); Any help would be very appreciated!
Create an account or sign in to comment