Search

Rss Posts

Rss Comments

Login

 

Posts in ‘JavaScript’

How to make onclick for show or hide div?

Dec 01

it is easy! to show div in javascript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<style>
#hide_show{
display:none
}
</style>
<script language="javascript">
function hidediv(div) {
 
  if (document.getElementById)
     document.poppedLayer = eval('document.getElementById(div)');
  else if (document.all)
     document.poppedLayer = eval('document.all[div]');
  else
     document.poppedLayer = eval('document.layers[div]');
  document.poppedLayer.style.display = "none";
}
 
function showdiv(div) {
  if (document.getElementById)
     document.poppedLayer = eval('document.getElementById(div)');
  else if (document.all)
     document.poppedLayer = eval('document.all[div]');
  else
     document.poppedLayer = eval('document.layers[div]');
  document.poppedLayer.style.display = "block";
}
</script>
<a href="#" onclick="showdiv('hide_show')">show</a> 
<a href="#" onclick="hidediv('hide_show')">show</a>
<div id="hide_show">
<h1>Here I am!</h1>
</div>

How Can I change table cellPadding from JavaScript?

Jan 22

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script type=”text/javascript”>
function padding(){
document.getElementById(’myTable’).cellPadding=”20″
}
</script>
 
<table id=”myTable” border=”1″>
<tr>
<td>first</td>
<td>second</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
</table>
<form>
<input type=”button” onclick=”padding()” value=”Change Cellpadding to 20″>

How do I place text to div?

Jan 16

JavaScript allowing to do this by this easy steps:

1
2
3
4
5
<script type=”text/javascript”>
document.getElementById("z").innerHTML = "bla bnla";
</script> 
 
<diz id=”z”> Text goes here</div>
 
Get Adobe Flash playerPlugin by wpburn.com wordpress themes
28 queries. 0.166 seconds.