easyui动态添加tab标签

easyui核心文件和皮肤就不引了,直接上代码。。。。希望对需要的人有帮助。

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>easyui动态添加tab标签</title>
<script type="text/javascript">
function addTab(title,url){
if($("#tt").tabs('exists',title)){
$("#tt").tabs('exists',title);
}else{

var content='<iframe scorlling="auto" frameborder="0" src="'+url+'" style="height:600px;width:1200px"></iframe>';
$("#tt").tabs('add',{
title:title,
content:content,
closable:true
});
}
}
</script>
</head>
<body>

<div style="margin-bottom: 10px">
<a href="#" class="easyui-linkbutton" onclick="addTab('csdn','http://www.csdn.net/jhkjcb/')">csdn</a>
<a href="#" class="easyui-linkbutton" onclick="addTab('jquery','http://www.jquery.com')">jquery</a>
<a href="#" class="easyui-linkbutton" onclick="addTab('baidu','http://www.baidu.com')">baidu</a>
</div>
<div id="tt" class="easyui-tabs" style="width: 1200px;height: 600px;">
<div title="home"></div>
</div>

</body>
</html>

猜你喜欢

转载自blog.csdn.net/lichongxyz/article/details/79099832