Difference between revisions of "JavaScript"
From Ilianko
(Created page with "<code><pre> <script> function hide(id) { var e = document.getElementById(id); if(e.style.display == 'inline') e.style.display = 'none'; else ...") |
|||
Line 1: | Line 1: | ||
+ | Показване и скриване на елемент. | ||
+ | |||
<code><pre> | <code><pre> | ||
<script> | <script> | ||
− | function hide(id) { | + | function hide(id) |
− | + | { | |
− | + | var e = document.getElementById(id); | |
− | + | if(e.style.display == 'inline') | |
− | + | e.style.display = 'none'; | |
− | + | else | |
− | + | e.style.display = 'inline'; | |
+ | } | ||
</script> | </script> | ||
− | |||
− | + | <p onclick="hide('b')">SEO - оптимизация за търсачки</p> | |
− | |||
<div id="b" style="display:none;position:relative; left:15px; top:10px"> | <div id="b" style="display:none;position:relative; left:15px; top:10px"> | ||
− | + | <img onclick="hide('b')"src="logo.png" /> | |
− | + | </div> | |
− | |||
</pre></code> | </pre></code> |
Latest revision as of 11:58, 17 June 2011
Показване и скриване на елемент.
<script>
function hide(id)
{
var e = document.getElementById(id);
if(e.style.display == 'inline')
e.style.display = 'none';
else
e.style.display = 'inline';
}
</script>
<p onclick="hide('b')">SEO - оптимизация за търсачки</p>
<div id="b" style="display:none;position:relative; left:15px; top:10px">
<img onclick="hide('b')"src="logo.png" />
</div>