这样做也不是很简单:
<body onload="FrmLoad()">
<script>
function FrmLoad(){
alert("load...");
}
str = document.body.onload.toString();
str = str.substring(str.indexOf('{')+1,str.length-1);
alert(str);
</script>
</body>
<body onload="FrmLoad()">
<script>
function FrmLoad(){
alert("load...");
}
str = document.body.onload.toString();
str = str.substring(str.indexOf('{')+1,str.length-1);
alert(str);
</script>
</body>
解决方案 »
- 滚动文字 的 暂停/开始
- 求救,<label>的问题?
- 设置$(window).scroll(function(){ $(window).scrollTop(0); });禁止浏览器滚屏后如何恢复浏览器滚屏?
- 请问如何能得知指定文件大小?
- 知道一个FOrm的text,如何得知该text所在的前一个td中的文字
- window.showModalDialog()窗口如何全屏?
- 求菜单Javascript代码
- 有个疑问请大家指点, 关于 readyState
- 如何在裢接中执行一段命令:如 运行一个本地的exe文件
- 相同的事件,如何连写,谢谢
- JavaScript实现回退到上一页面, 求语句
- 关闭网页时弹出"是否设为首页"的对话框问题
<script language=javascript>
function test()
{
alert("haha")
alert(document.body.onload.toString())
}
</script>
<body onload=test()>
这样我想可能比拿HTML匹配好匹配一些
其实直接写重载方法不好吗
document.body.onload=function haha()
{
新的函数
}
这样就不用名字了
<html xmlns:v="http://www.eglic.com/">
<head>
<title></title>
<meta name="Generator" content="EditPlus" />
<meta name="Author" content="eglic" />
<meta name="ContentType" content="text/html" />
<meta name="CharSet" content="GB2312" />
<link rel="stylesheet" type="text/css" href="/style/default.css" />
<style type="text/css">
</style>
<script language="javascript" src="/script/default.js"></script>
<script language="javascript" defer>
function doc_Load(){
}
document.onload=doc_Load;
function test(){
if(document.onload){
var s=document.onload.toString();
s=s.substr(s.indexOf('function')+8,s.length);
s=s.substr(0,s.indexOf('('));
s=s.replace((/(^\s*)|(\s*$)/ig),'');
alert('document 的onload事件处理函数名为:' + s);
}else{
alert('没有指定 document 的onload事件处理函数');
}
}
</script>
</head>
<body>
<button onclick="JavaScript:test();">测试一下</button>
</body>
</html>