I'm trying to use functions after taking a break from JavaScript (due to it giving me much grief with its syntax) and it again has decided to treat me brutally again, ignoring my functions.
<script type="text/javascript">
channel = 1
channel_array = ["welcome_mat.html", "http://www.youtube.com/user/1americanews"];
function Oooh(e){
var unicode=e.keyCode? e.keyCode : e.charCode
alert(unicode);
if (unicode == 38);{
alert("You hit the up button.");
if (channel == 65);{
channel = 1;
document.getElementById("Frame").src = channel_array[channel]
}
else{
channel = channel + 1;
document.getElementById("Frame").src = channel_array[channel]
}
}
}
</script>
<input id="text2" type="text" size="2" maxlength="1" onkeyup="Oooh(event); this.select()" />
<script type="text/javascript">
document.getElementById("Frame").src="http://www.youtube.com/user/1americanews";
document.getElementById("text2").focus();
</script>
You mentioned that you have trouble with JavaScript's syntax, which your code does.
The corrected version is this: