NetSago
Enter
Log In

How to join?
Menu
Home
News
 Notes
Articles ↓
Tags
Search
About Project
Links
Ours
RSS News RSS
RSS Notes RSS
netsago NetSago
Topically
Authorisation system on environment variables. by n0xi0uzz

Phrack all issues downloader by n0xi0uzz

Notes — Dynamic hiding/opening elements on the webpage (JavaScript).
Back to Notes

Dynamic hiding/opening elements on the webpage (JavaScript).
n0xi0uzz



Tags: html javascript div



To hide or open some elemet on the webpage, here is a simple JavaScript function:
function showBlock(id)
{
	if (document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display='inline';
	} else {
		document.getElementById(id).style.display = 'none';
	}

        

}

To use it you should pass id of element wich you want open or hide as parameter.

Here is the expamle whith the <div> tag:

<a href="#" onclick="showBlock('whypage'); return false;" class="menu">Title.</a>
<div id="whypage" style="display:none" class="block">Some text</div>

By clicking on this link element will hide or open.
Language
Russian/Русский
Search
Advanced Search
Report a Bug
If you find a bug on our site please report us.
Counters
49 / 1713
Today we have 563 visits by robots. They want to kill all humans.

Registered users: 0
Online: 0

Page build time: 0.020 sec
NetSago.v2.β © [2006;∞)  Neunica