ff下弹出undefined
在firebug里面看 div里面确实有了个menu的属性,但是却还是弹出undefined,这是为什么了
<!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>
<div id='ss'> </div>
<input value="aaa" type="button" onclick="show()"/>
<script language="javascript">
var div =null;
window.onload = function(){
div = document.getElementById('ss');
div.setAttribute("menu",'aaa');
}function show(){
alert(div.menu)
}
</script>
</body>
</html>
在firebug里面看 div里面确实有了个menu的属性,但是却还是弹出undefined,这是为什么了
<!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>
<div id='ss'> </div>
<input value="aaa" type="button" onclick="show()"/>
<script language="javascript">
var div =null;
window.onload = function(){
div = document.getElementById('ss');
div.setAttribute("menu",'aaa');
}function show(){
alert(div.menu)
}
</script>
</body>
</html>
解决方案 »
- 运行该HTML之后,点击全屏按钮,出现错误“large()函数未定义”,百思不得其解,求高手指教
- 请问126写信中通讯录上,点击那个小图标是通讯录展开,小图标即变为下拉形式的怎么做?
- csdn高人指点 javascript可以修改桌面背景吗?
- 简单问题 快速送分
- 急!!!!!表单提交后判断值是否为空的问题!
- 求助!javascript写的web菜单有问题。
- dullwolf(超级大笨狼) 对"点击页面出现文本框"的回复,我想生成下拉框
- window.open或onload的问题,在线等待
- javascript中怎么运行声音文件
- 问题3
- 用document.execCommand可以取到选中的字符吗?
- 各位大侠来看看 小弟求教
alert(div.getAttribute('menu'))
<!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>
<div id='ss'> </div>
<input value="aaa" type="button" onclick="show()"/>
<script language="javascript">
var div =null;
window.onload = function(){
div = document.getElementById('ss');
div.setAttribute("menu",'aaa');
//div.menu = 'aaa';
}function show(){
alert(div.getAttribute('menu'))
}
</script>
</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>
<div id='ss'> </div>
<input value="aaa" type="button" onclick="show()"/>
<script language="javascript">
var div =null; div = document.getElementById('ss');
div.setAttribute("menu",'aaa');
function show(){
alert(div.getAttribute('menu'));
}
</script>
</body>
</html>