Forum Moderators: open

Message Too Old, No Replies

Problems with javascript running in Firefox (OnMouseOver)

         

cookj24

4:47 pm on Sep 29, 2008 (gmt 0)

10+ Year Member



Pretty simple im having a problem with a mouseover event. Div sections are not changing the inner html. Heres code:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="JavaScript" type="text/javascript">

var description = new Array();
description[0] = "";
description[1] = "You can even embed <b>HTML</b> into the link description.";
description[2] = "<i>Link to Example.com</i>";

var title = new Array();
title[0] = "efsd";
title[1] = "";
title[2] = "";

function overContentChange(title_val, desc_val)
{
HeadTitle.innerHTML = title[title_val];
HeadContent.innerHTML = description[desc_val];
}

function outContentChange(title_val, desc_val)
{
HeadTitle.innerHTML = title[title_val];
HeadContent.innerHTML = description[desc_val];
}

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="ssasa" onmouseover="overContentChange(0, 1)" onmouseout="outContentChange(1, 0)">start</a><br/>
<div id="HeadTitle"></div>
<div id="HeadContent"></div>
</div>
</form>
</body>
</html>

[edited by: Fotiman at 5:55 pm (utc) on Sep. 29, 2008]
[edit reason] Replaced site reference with Example.com [/edit]

Receptional Andy

4:53 pm on Sep 29, 2008 (gmt 0)



Welcome to WebmasterWorld, cookj24 :)

To select an element by ID you need to use getElementByID - e.g.

document.getElementById('HeadTitle').innerHTML

cookj24

4:57 pm on Sep 29, 2008 (gmt 0)

10+ Year Member



hah, that would probably make sence :)

works fine now.

Thx andy.