<a href="">1</a>
<a href="">2</a>
<a href="">3</a>
<a href="">4</a>
<script>
var var1 = '1';
var var2 = '2';
var var3 = '3';
var var4 = '4';
if (var1 == '1') {
document.write('html1');
}
if (var1 == '2') {
document.write('html2');
}
if (var1 == '3') {
document.write('html3');
}
if (var1 == '4') {
document.write('html4');
}
</script>
<a href="#" onclick="return write(this.innerHTML);">1</a>
<a href="#" onclick="return write(this.innerHTML);">2</a>
<a href="#" onclick="return write(this.innerHTML);">3</a>
<a href="#" onclick="return write(this.innerHTML);">4</a>
<script>
var var1 = '1';
var var2 = '2';
var var3 = '3';
var var4 = '4';
function write(var){
var data = '';
switch (var){
case '1'
data = 'html1';
break;
case '2'
data = 'html2';
break;
case '3'
data = 'html3';
break;
case '4'
data = 'html4';
break;
}
document.write('html1');
}
</script>