For example, I have the HTML code %26lt;span id="hello" style="visibility:hidden"%26gt; Hello %26lt;/span%26gt; What code would I put around the other phrase "Say hello!" to make it so that when "Say hello!" is clicked, the word Hello becomes visible?
How do I make something visible when clicking something else in HTML?
You need to use Javascript for that:
function ShowSpan()
{
var helloSpan = document.getElementById("hello");
if(helloSpan != null)
{
helloSpan.style = "display:block";
}
}
And in the click event of the button you need to specify the function name something like this:
onClick = "javascript:ShowSpan();"
Reply:You couldn't do it in html, you would have to use javascript or load a whole new page, which I don't think is what you want.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment