1、定义数组,和定义对象;
var tNodes = new Array();
var tNode = {
id: data[i].id, pId: data[i].parent_id, name: data[i].name,
};
tNodes.push(tNode);
2、、小技巧;
function closewin(){
window.opener.location.reload();
window.close();
}
3、得到复选框值得代码;
var role = $("input[name='role']");
var roles = '';
for(var i=0; i<role.length; i++){
if(role[i].checked){
roles = roles + role[i].value + ",";
}
}
var tNodes = new Array();
var tNode = {
id: data[i].id, pId: data[i].parent_id, name: data[i].name,
};
tNodes.push(tNode);
2、、小技巧;
function closewin(){
window.opener.location.reload();
window.close();
}
3、得到复选框值得代码;
var role = $("input[name='role']");
var roles = '';
for(var i=0; i<role.length; i++){
if(role[i].checked){
roles = roles + role[i].value + ",";
}
}
if(roles=='') roles='$';
4、在JavaScript语言中触发鼠标事件;
<a id="alink" href="abc.aspx" style="visibility: hidden;">下一步</a>
$("#alink").click(); // 触发了a标签的点击事件,但是没有触发页面跳转
document.getElementById("alink").click(); //既触发了a标签的点击事件,又触发了页面跳转
5、解决jQuery版本之间的冲突问题;
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var j = jQuery.noConflict(true);
</script>
<script type="text/javascript" src="jquery-1.7.js"></script>
<script type="text/javascript">
$(“document").ready(function(){
alert(“faf");
})
j(“document").ready(function(){
alert(“faf");
})
</script>