Quotes help make search much faster. Example: "Practice Makes Perfect"

Sunday, December 16, 2012

Codecademy Sample Solution: Codeyear Adding More Values and More DIVs



<!--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


This is an example of scrolling text using Javascript.

Popular Posts