回复 9楼Alice的帖子
这是我写的代码,没有效果,麻烦看看!
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="tabs.aspx.cs" Inherits="WebApplication1.tabs" %>
<%@ Register assembly="C1.Web.Wijmo.Controls.4" namespace="C1.Web.Wijmo.Controls.C1Tabs" tagprefix="wijmo" %>
<!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 runat="server">
<title></title>
<script language="javascript" type="text/javascript">
$('mainTabs').find("ul li").append('<span class="ui-icon ui-icon-close">Remove Tab</span>');
var $tab_title_input = "测试标签1",
$tab_content_input = "no",
tab_counter = 2;
var $tabs = $('mainTabs').c1tabs({
tabTemplate: '<li><a href="#{href}">#{label}</a> <span class="ui-icon ui-icon-close">Remove Tab</span></li>',
add: function (event, ui) {
alert(event);
var tab_content = $tab_content_input.val() || 'Tab ' + tab_counter + ' content.';
$(ui.panel).append('<p>' + tab_content + '</p>');
}
});
$('mainTabs').on('click', 'span.ui-icon-close', function () {
var index = $('li', $tabs).index($(this).parent());
$tabs.c1tabs('remove', index);
});
function addtabs() {
var tab_title = $tab_title_input.val() || 'Tab ' + tab_counter;
$tabs.c1tabs('add', '#tabs-' + tab_counter, tab_title);
tab_counter++;
$tab_title_input.val("");
$tab_content_input.val("");
$(this).c1dialog("close");
}
function cancelClick() {
$(this).c1dialog("close");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<wijmo:C1Tabs ID="mainTabs" runat="server" style="">
< ages>
<wijmo:C1TabPage ID="mainTabs_2" runat="server" StaticKey="" Text="测试标签">
</wijmo:C1TabPage>
</Pages>
</wijmo:C1Tabs>
<input id="add" type="button" value="add" onclick="addtabs()" />
</div>
</form>
</body>
</html>
我运行以后应该是报错了,如下图
这个是按照示例写的,请问应该怎么写? |