// Exercise 2.2
alert('If this message alerts, the JavaScript file is properly linked!');
function myFunction() {
// Exercise 2.3
alert("In myFunction!");
// Exercise 2.5
var theImage = document.getElementById('theImage');
alert("BEFORE changing it...\n\nThe image's src attribute is:\n'" + theImage.src +
"'\n\nIts alt attribute is:\n'" + theImage.alt + "'");
// Exercise 2.6
theImage.src = 'keyboard-cat.jpg';
theImage.alt = 'Keyboard cat!';
alert("AFTER CHANGING IT...\n\nThe image's src attribute is now:\n'" + theImage.src +
"'\n\nIts alt attribute is:\n'" + theImage.alt + "'");
// Exercise 2.7
document.getElementById('textbox').value = 'HAHA';
document.getElementById('textarea').value = 'LOL HAX';
}
// Exercise 2.8
// Copy the contents of copy_textbox into copy_span.
function copy() {
var copy_textbox = document.getElementById('copy_textbox');
var copy_span = document.getElementById('copy_span');
copy_span.innerHTML = copy_textbox.value;
}