<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script>
window.onload=function(){
var q = document.getElementsByName('q');
for (var i=0; i < q.length; i++){
if (q[i].innerHTML == '1'|| q[i].innerHTML =='2'){
document.getElementById('gofor').onclick=function(){
alert ('не прокатило');
};
return;
};
};
document.getElementById('gofor').onclick=function() {alert("Прокатило")};
}
</script>
</head>
<body>
<a name="q">3</a><br>
<a name="q">4</a><br>
<a name="q">5</a><br>
<a name="q">6</a><br>
<a name="q">7</a><br>
<input type="button" id="gofor" value="Тык">
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script>
window.onload=function(){
var q = document.getElementsByName('q');
for (var i=0; i < q.length; i++){
if (q[i].innerHTML == '1'|| q[i].innerHTML =='2'){
document.getElementById('gofor').onclick=function(){
alert ('не прокатило');
};
return;
};
};
document.getElementById('gofor').onclick=function() {alert("Прокатило")};
}
</script>
</head>
<body>
<a name="q">1</a><br>
<a name="q">2</a><br>
<a name="q">3</a><br>
<a name="q">4</a><br>
<a name="q">5</a><br>
<a name="q">6</a><br>
<a name="q">7</a><br>
<input type="button" id="gofor" value="Тык">
</body>
</html>