user1433032 user1433032 - 1 year ago 75
Javascript Question

Multiple Functions in Javascript

I'm sorry if this is a really stupid question, I'm a little new to JavaScript. I am trying to make a webpage containing multiple functions, but only the first of the functions will be successful. I searched on google and I only got results for calling multiple functions at once, but that is not what I am looking for. Here is an example of what I am trying to do:

<script type="text/javascript">
function frogger()
document.getElementById("descriptions").innerHTML="Frogger <br />Description: Get
the frog to the islands at the top of the screen without falling into the water or
getting hit by cars. <br />Controls: Up arrow key to move forward, down arrow key to
move backward, left arrow key to move left, and right arrow key to move right.";
function clear()
document.getElementById("descriptions").innerHTML=" ";
<div id="descriptions" style="{height:100;}">
<div class="game" onmouseover="frogger()" onmouseout="clear()">
<a href="/arcade/frogger.html"><img border="0" src="
/pics/frogger.PNG" height="100" width="100" /><br />Frogger</a>

Thanks for helping!

Answer Source

There is already a function named clear in the document object. Name your function something else.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download