JS版元素周期表实现方法版元素周期表实现方法
主要介绍了JS版元素周期表实现方法,可实现基于javascript动态生成元素周期表的功能,点击元素项可以在下方显示对应元素
的各种常用属性,需要的朋友可以参考下
本文实例讲述了JS版元素周期表实现方法。分享给大家供大家参考。具体如下:
这里的元素周期表基于JavaScript实现,未使用任何的图片,直接浏览本HTML网页即可看到效果,可以作为教学使用。
运行效果如下图所示:
具体代码如下:
<html>
<head>
<style type="text/css">
<!--
A{color:000000;font-size:9pt; TEXT-DECORATION: none}
A:hover{color: 00dd00}
-->
</style>
<title>元素周期表</title>
<script language="JavaScript">
<!--hide this script from crappy old browsers
function prepare()
{
window.setTimeout("window.status='这是例子'",500);
}
function moveover(txt)
{
window.status = txt;
}
function fillitin(Name, AtomicNumber,AtomicWeight, Shells, FillingOrbital, MeltingPoint, BoilingPoint)
{
moveover(Name); //写入状态栏说明
document.PeriodicTable.Name.value=Name; //写入元素名
document.PeriodicTable.AtomicNumber.value=AtomicNumber; //写入元素序号
document.PeriodicTable.AtomicWeight.value=AtomicWeight; //写入原子量
document.PeriodicTable.Shells.value=Shells; //写入电子层描述
document.PeriodicTable.FillingOrbital.value=FillingOrbital; //写入轨道
document.PeriodicTable.MeltingPoint.value=MeltingPoint; //写入熔点
document.PeriodicTable.BoilingPoint.value=BoilingPoint; //写入沸点
window.setTimeout("prepare()",3500); //延时3.5秒后恢复状态栏显示
}
<!-- done hiding from old browsers -->
</script>
</head>
<body onload="prepare();">
<table border="4" width="51%" bordercolorlight="#DDDDDD" cellspacing="0" cellpadding="4" bordercolor="#DDDDDD">
<tr>
<td width="100%">
<table border="1" width="60%" cellspacing="0" cellpadding="3" bordercolor="#A4A4A4">
<tr>
<td width="100%">
<form method="Post" name="PeriodicTable">
<table border="1" cellspacing="0" bordercolor="#FFFFFF" bordercolorlight="#000000" width="534" height="182" style="font-family: Arial; FONT-SIZE:9PT" cellpadding="0">
<tr>
<td width="522" height="7" colspan="18">元素周期表</td>
</tr>
<tr>
<td bgcolor="#CCFFCC" width="29" height="6" align="center"><a href="javascript: fillitin('Hydrogen','1','1.0079','1','1s1','-259.14 C','-252.87 C');">H</a></td>
<td colspan="16" width="463" height="6"> </td>
<td bgcolor="#CCFFCC" width="30" height="6" align="center">
<ahref="javascript: fillitin('Helium','2','4.0026','2','1s2','-272C @ 26ATM','-268.6 C');">He</a></td>
</tr>
<tr>
<td width="29" height="16" align="center"><a
href="javascript: fillitin('Lithium','3','6.94','2,1','2s1','180.54 C','1347 C');">Li</a></td>
<td width="29" height="16" align="center"><a
href="javascript: fillitin('Beryllium','4','9.01218','2,2','2s2','1278 C','2970 C');">Be</a></td>
<td colspan="5" width="139" height="16" align="center">固体</td>
<td colspan="5" bgcolor="#DDDDDD" width="139" height="16" align="center">人造元素</td>
<td width="30" height="16" align="center"><a
href="javascript: fillitin('Boron','5','10.81','2,3','2p1','2300 C','2550 C');">B</a></td>
<td width="30" height="16" align="center"><a
href="javascript: fillitin('Carbon','6','12.011','2,4','2p2','3500 C','4827 C');">C</a></td>
<td bgcolor="#CCFFCC" width="30" height="16" align="center"><a
href="javascript: fillitin('Nitrogen','7','14.0067','2,5','2p3','-209.9 C','-195.8 C');">N</a></td>
<td bgcolor="#CCFFCC" width="30" height="16" align="center"><a
href="javascript: fillitin('Oxygen','8','15.9994','2,6','2p4','-218.4 C','-183.0 C');">O</a></td>
<td bgcolor="#CCFFCC" width="30" height="16" align="center"><a
href="javascript: fillitin('Flourine','9','18.998403','2,7','2p5','-219.62 C','-188.14 C');">F</a></td>
<td bgcolor="#CCFFCC" width="30" height="16" align="center"><a
href="javascript: fillitin('Neon','10','20.17','2,8',' 2p6','-248.6 C','-246.1 C');">Ne</a></td>
</tr>
<tr>
<td width="29" height="16" align="center"><a