JavaScript动态生成树形菜单创建表格
<!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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>无限级树形菜单</title>
<mce:style><!--
#A1 td { vertical-align: top; }
#A1 td.bj { font-family: Wingdings; color: #FF9933; text-align: center; }
#A1 td.bj , #A1 td.kg { width: 24; }
#A1 a:link , #A1 a: visited { color: #cc0080; text-decoration: none; }
#A1 a:hover { color: #0ff080; text-decoration: none; }
--></mce:style><style mce_bogus="1">#A1 td { vertical-align: top; }
#A1 td.bj { font-family: Wingdings; color: #FF9933; text-align: center; }
#A1 td.bj , #A1 td.kg { width: 24; }
#A1 a:link , #A1 a: visited { color: #cc0080; text-decoration: none; }
#A1 a:hover { color: #0ff080; text-decoration: none; }</style>
<mce:script language="JavaScript"><!--
function m_start(name,tt) //菜单组开始
{
document.writeln('<tr><td class="bj">'+(tt==1?'1':'0')+'</td>');
document.writeln('<td><a href="#" mce_href="#" onclick="zgmm()">'+name+'</a></td>');
document.writeln('</tr>');
document.writeln('<tr style="display: '+(tt==1?'block':'none')+';" mce_style="display: '+(tt==1?'block':'none')+';">');
document.writeln('<td class="bj"> </td>');
document.writeln('<td>');
document.writeln('<table border="0" cellpadding="0" cellspacing="0">');
}
function m_end() //菜单组结束
{
document.writeln('</table></td></tr>');
}
function add_Sub(name,url,kj) //添加菜单项
{
document.writeln('<tr><td class="bj">2</td><td>');
document.writeln('<a target="'+kj+'" href="'+url+'" mce_href="'+url+'">'+name+'</a>');
document.writeln('</td></tr>');
}
functi
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
1.Jscript 不认为语句块是一个新的范围(作用域)只有函数创建新的范围。
2.JScript语句中使用等号(=)给变量赋值:等号是赋值运算符。
“=”运算符左边的操作项总是一个Lvalue,即可以是:
对象,
数组元素,
对象属性。
“=”运算符右边的操作项总是一个Rvalue ......
document.close();
document.open();
function jsonFormat(template, json) {
return template.replace(/\$\{(.+?)\}/g, function ($, $1) {
return json[$1];
});
}
var links = [
{ text: "人肉搜索", url: "http://renrousousuo.com" } ,
{ text: "CSDN", url: &qu ......
JavaScript中的剪贴板(clipboardData)
clipboardData 对象
提供了对剪贴板的访问。
三个方法
1.clearData(sDataFormat) 删除剪贴板中指定格式的数据。
2.getData(sDataFormat) 从剪贴板获取指定格式的数据。
3.setData(sDataFormat, sData) 给剪贴板赋予指定格式的数据。返回 true 表示操作成功。
例子
<script ......