user794008
user794008

Reputation: 11

Javascript InnerHtml in Firefox

Anyone know why this isn't working in Firefox?

    <script type="text/javascript">
function goHo() {
hu.innerHTML="????";
}
</script>
<div class="contentPane" id="Calculator" style="display: block;">
                    <h2>Savings Calculator</h2><a href="Home" class="backArrow"></a>
                    <h3>How much do you spend on heating and hot water a year?</h3>
                    <div id="SpendOptions">
                        <ul class="optionList">

                            <a href="#" onMouseOut="goHo()" onMouseOver="hu.innerHTML='£60-180'"><li id="CostOption1">£600 - £900</li></a>
                            <a href="#" onMouseOut="goHo()" onMouseOver="hu.innerHTML='£90-240'"><li id="CostOption2">£900 - £1200</li></a>
                            <a href="#" onMouseOut="goHo()" onMouseOver="hu.innerHTML='£120-300'"><li id="CostOption3">£1200 - £1500</li></a>
                            <a href="#" onMouseOut="goHo()" onMouseOver="hu.innerHTML='£150-360'"><li id="CostOption4">£1500 - £1800</li></a>
                            <a href="#" onMouseOut="goHo()" onMouseOver="hu.innerHTML='£360'"><li id="CostOption5">£1800+</li></a>
                        </ul>

                    </div>
  <div id="SavingsBox" style="display: block;">
                        <h4>This year you could save:</h4>
                        <h1 id="hu"></h1>

                    </div>

Upvotes: 1

Views: 3732

Answers (4)

Mrchief
Mrchief

Reputation: 76238

You can also say:

<a href="#" onMouseOut="goHo('????')" onMouseOver="goHo('£60-180')">...

function goHo(html) {
   document.getElementById('hu').innerHTML=html;
}

Demo: http://jsfiddle.net/8fUcG/2/

Upvotes: 0

JAiro
JAiro

Reputation: 6009

try:

 function goHo() {
     document.getElementById('hu').innerHTML="????";
 }

Upvotes: 1

K&#39;&#39;
K&#39;&#39;

Reputation: 5238

You need to use document.getElementById('hu').innerHTML = "???"

Upvotes: 0

cwallenpoole
cwallenpoole

Reputation: 82058

hu should be document.getElementById("hu"). (Just because an item has an ID, that does not mean that it will be a declared variable (id and existence as a variable have little to do with each other))

Upvotes: 5

Related Questions