可以参考下..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<script type="text/javascript">
function $(id){
return document.getElementById(id);
}
function start(){
alert("开始!");
$("btnStart").value = "暂停";
$("btnStart").onclick = pause;
}
function pause(){
alert("暂停");
$("btnStart").value = "开始";
$("btnStart").onclick = start;
}
window.onload = function(){
$("btnStart").onclick = start;
};
</script><input type="button" id="btnStart" name="btnStart" value="开始" />
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<script type="text/javascript">
function $(id){
return document.getElementById(id);
}
function start(){
alert("开始!");
$("btnStart").value = "暂停";
$("btnStart").onclick = pause;
}
function pause(){
alert("暂停");
$("btnStart").value = "开始";
$("btnStart").onclick = start;
}
window.onload = function(){
$("btnStart").onclick = start;
};
</script><input type="button" id="btnStart" name="btnStart" value="开始" />
</body>
</html>
<script language='javascript'>
function do(obj,flag)
{
switch(flag)
{
case 0:
alert(this.value)
obj.onclick=function()
{
do(this,1)
}
obj.value='暂停'
break
case 1:
alert(this.value)
obj.onclick=function()
{
do(this,0)
}
obj.value='开始'
break
default:
}
}
</script>
<html>
<head>
<script>
function mystart(){
alert("start");
var _button = document.getElementById('start');
_button.value="other";
_button.onclick = myother;
}
function myother(){
alert("other");
}
</script>
</head>
<body>
<input type="button" id='start' value="start" onclick="mystart()">
</body>
</html>lz参考一下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<script type="text/javascript">
function $(id){
return document.getElementById(id);
}function bt1(){
alert("开始")
}
function bt2(){
alert("暂停")
}
function bt3(){
alert("继续")
}
function bt4(){
alert("停止")
}
var bt=[
["开始","bt1()"],
["暂停","bt2()"],
["继续","bt3()"],
["停止","bt4()"]
]
var btN=0
function DoIt(obj){
btN++
if (btN>=bt.length)
//return;//终止
btN=0;//循环
obj.value=bt[btN][0]
eval(bt[btN][1])
}
</script><input type="button" id="btnStart" name="btnStart" value="开始" onclick=DoIt(this) />
</body>
</html>