When I execute my functions the first one works fine and the second is called because I get my alert box but the second function does not execute. Any ideas why? Any input is appreciated.

function changeFont()
    {
                 <!--alert("changeFont function");-->
    document.getElementById("q4").style.fontStyle ="italic";

    }

    function changeFontBack()
    {
    alert("changeFontBack function");
    document.getElementById("q4").style.fontStyle="normal";
      }

<!-- this is the line it executes from -->

<p id="q4" onmouseOver="changeFont()" id ="q4"onClick="changeFontBack()">5. Part 1. Mouseover this paragraph to change the font to a font of you choice. Part 2. Click on this paragraph to return the font to the default font.</p>


    }

Recommended Answers

All 2 Replies

The alert box stops subsequent processing
comment out the alert box as it is in the prior script and it will work
or place the alert box after the function and it will work

The alert box stops subsequent processing
comment out the alert box as it is in the prior script and it will work
or place the alert box after the function and it will work

Thanks almostbob that did the trick. hard to believe I was that close

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.