JS - 转义
2017-09-09 •
评论
<script>
var func = "<a href='?uuid="" + <?php echo $uuid;?> + ""' onclick='if(confirm("确认要删除吗?")) return true;else return false;'>删除</a>";
</script>
<script>
function SelectAll() {
var operate = $(".member_tab tr");
var bool = $("#allchecked").attr('checked');
operate.each(function () {
$(this).find('input[type=checkbox]').attr("checked", bool ? true : false);
});
}
</script>
<table class="member_tab" width="100%">
<!--{if $peoplestr}-->
<tr>
<th style=" text-align:center;" width="4%">
<input name="xuan" type="checkbox" id="allchecked" onclick="SelectAll()" />
</th>
<th><span>|</span>用户名</th>
<th><span>|</span>姓名</th>
<th><span>|</span>手机号</th>
<th><span>|</span>邮箱</th>
</tr>
<!--{foreach item=people from=$peoplestr name=foo}-->
<tr>
<td style="text-align:center;">
<!--{if $people.uuid neq $uuid}-->
<input name="delte" type="checkbox" value="<!--{$people.id}-->" />
<!--{/if}-->
</td>
<td><!--{$people.username}--></td>
<td><!--{$people.name}--></td>
<td><!--{$people.move}--></td>
<td><!--{$people.email}--></td>
</tr>
<!--{/foreach}-->
<!--{/if}-->
</table>
退出代码
<script>window.parent.location.href='/login';</script>
在登录页增加如下代码
<script>
if (window != top) {
top.location.href = location.href;
}
</script>
提交表单时报错:e[h] is not a function
原因:<button> 的 id 或 name 不可为 submit, 更名后即可。
public function indexAction() {
//获取父级代号pid
$pid = $this->getParam('pcode');
//数据查询
$areaModel = new Model_Area();
$fields = "*";
$whereArr[] = array('pid', $pid);
$areadetail = $areaModel->getArea($fields, $whereArr);
//var_dump($areadetail);
echo json_encode($areadetail);
}
var ue = UE.getEditor('editor2', {
toolbars: [[
'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', '|',
'selectall', 'cleardoc', '|',
'fontfamily', 'fontsize', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
'simpleupload', '|',
'removeformat', '|'
]],
iframeCssUrl: '../ueditor/themes/editor2.css',
initialFrameHeight:500,
enableAutoSave: false,
enableContextMenu: false,
elementPathEnabled : false,
focus:false,
autoHeightEnabled:false
});
var arr1 = new Array(3);
arr1[0] = "a";
arr1[1] = "b";
arr1[2] = "c";
arr1[3] = "d";
var arr2 = new Array(3);
arr2[0] = "x";
arr2[1] = "y";
arr2[2] = "z";
console.log(arr1);
console.log(arr2);
var length = arr1.length;
console.log(length);
var arr3 = new Array(3);
for(var j=0;j<length;j++){
var a = 2*j;
console.log(a);
var b = 2*j+1;
console.log(b);
arr3[a]=arr1[j];
arr3[b]=arr2[j];
}
console.log(arr3);
var str = arr3.join("");
console.log(str);
//axbyczd
function download(src) {
var a = document.createElement('a');
a.setAttribute("href", src);
a.setAttribute("download", "");
var evObj = document.createEvent('MouseEvents');
evObj.initMouseEvent( 'click', true, true, window, 0, 0, 0, 0, 0, false, false, true, false, 0, null);
a.dispatchEvent(evObj);
};