Jump to content

Hide/show Button Code


niceshare

Recommended Posts

Hi everyoneDo you have any ideas how to write hide/show code please? that when visitors go to your blog, the button does not appear immediately, after 10 seconds, it appears automatically.So please do you any idea please share, thank in advance.If you know please give the code for me, thank so much.Example: http://vv-link.co.cc/vault/071609/download...DMOMM_rs.1.html

Link to comment
Share on other sites

Hiding and showing usually involves using JavaScript to change the CSS display property.For it to work properly, you need to know how the element is normally displayed: as an inline element (like a <span> or an <img>) or as a block-level element (like a <p> or a <div>). <input type="button"> is by default an inline element.Of course, all elements can be redefined in CSS as inline or block. The most usual change is to make something like an image or a button a block-level element. That's what we'll do with your button.Anyway, your code would look something like this:CSS

input.hidden {	display: none;}

JavaScript

function hide(id) {	 el = documentGetElementById (id);	 el.style.display = "none"; }function show(id) {	 el = documentGetElementById(id);	 el.style.display = "block"; }

HTML

<p onclick="show('my_button')">Show</p><p onclick="hide('my_button')">Hide</p><input type="button" class="hidden" id="my_button" value="Do something!">

To put the show/hide functions on a timer, use one of these JavaScript methods: setInterval() or setTimeout().

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...