Jump to content

The Pub - Discuss Anything


Manuf
 Share

Recommended Posts

Anyone good with html?

I want to press a button and see have an image appear. Click the button see the image disappear. Any help?

Something like this: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_button_test

Only instead of an alert, an image appears.

You're better off using CSS to do that.

Link to comment
Share on other sites

I'm not sure if CSS is allowed in this particular piece of assessment but could you show me how to do it?

Here's a simple bit of code that should get it done...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  <head>    <meta content="text/html; charset=UTF-8" http-equiv="content-type" />     <meta charset="utf-8" />    <title>Test</title>    <style type="text/css">      .hidden {        display: none;      }    </style>  </head>  <body>    <form>      <input type="submit" id="submit" onclick="document.getElementById('hidden').style.display = 'block';" />     </form>     <img id="hidden" class="hidden" src="foo.png" />  </body></html>

Basic CSS really. Nothing too fancy. I'm not sure how you would do it using pure HTML, would be a lot of unnecessary code though.

Link to comment
Share on other sites

Here's a simple bit of code that should get it done...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  <head>    <meta content="text/html; charset=UTF-8" http-equiv="content-type" />     <meta charset="utf-8" />    <title>Test</title>    <style type="text/css">      .hidden {        display: none;      }    </style>  </head>  <body>    <form>      <input type="submit" id="submit" onclick="document.getElementById('hidden').style.display = 'block';" />     </form>     <img id="hidden" class="hidden" src="foo.png" />  </body></html>

Basic CSS really. Nothing too fancy. I'm not sure how you would do it using pure HTML, would be a lot of unnecessary code though.

Thank god for you. I've been spending hours trying to get it to work with basic html. A MILLION REPS FOR YOU IF I COULD.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • 0 members are here!

    • No registered users viewing this page.
×
×
  • Create New...

talk chelse forums

We get it, advertisements are annoying!
Talk Chelsea relies on revenue to pay for hosting and upgrades. While we try to keep adverts as unobtrusive as possible, we need to run ad's to make sure we can stay online because over the years costs have become very high.

Could you please allow adverts on this website and help us by switching your ad blocker off.

KTBFFH
Thank You