<!--sample solution to index.html-->
<html>
<head>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<button onclick="sayHello('world','any word you like')">Click Me</button>
<div id="result"></div>
<div id="result2"></div>
</body>
</html>
// sample solution to script.js
function sayHello(name, name2){
document.getElementById("result").innerHTML = 'Hello ' + name + '!';
document.getElementById("result2").innerHTML = 'Hello ' + name2 + '!';
}
No comments:
Post a Comment