smartclient--练习

恩 简单看了smartclient的文档,感觉和extjs差不多,和jquery也很相像,就是不明白为什么要用这个呢?

那个文档是纯英文的,本来我想翻译出来着大笑,后来被同事打击了一顿,万一别人想学,看了我翻译的文档就饱了 ,哈哈。这篇译文我先放着。

下面是我做的小练习:

<html>
<head>
	<title>this is a test !</title>
	<SCRIPT>var isomorphicDir="../../isomorphic/";</SCRIPT>
    <SCRIPT SRC=../../isomorphic/system/modules/ISC_History.js></SCRIPT>
    <SCRIPT SRC=../../isomorphic/system/modules/ISC_Core.js></SCRIPT>
    <SCRIPT SRC=../../isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
    <SCRIPT SRC=../../isomorphic/system/modules/ISC_Containers.js></SCRIPT>
    <SCRIPT SRC=../../isomorphic/system/modules/ISC_Grids.js></SCRIPT>
    <SCRIPT SRC=../../isomorphic/system/modules/ISC_Forms.js></SCRIPT>
    <SCRIPT SRC=../../isomorphic/system/modules/ISC_DataBinding.js></SCRIPT>
	<SCRIPT SRC=../../isomorphic/skins/SmartClient/load_skin.js></SCRIPT>
</head>
<body>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=5 BORDER=0>
	<TR><TD CLASS=pageHeader BGCOLOR=WHITE>按钮的测试</TD>
	<TD CLASS=pageHeader ALIGN=RIGHT BGCOLOR=WHITE>so easy!</TD>
</TR></TABLE>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD BGCOLOR=336666><IMG SRC=images/blank.gif WIDTH=1 HEIGHT=4></TD></TR></TABLE>
<script>
//创建一个按钮单击事件-----
isc.Button.create({
	ID:"clickBtn",
	left:50,
	top:70,
	title:"快单击我*_*",
	click:"clickBtnClicked()"
})
function clickBtnClicked(){
	isc.warn('单击我干嘛!');
}
function clickBtnClick(){
	isc.warn('想提交 没那么简单!');
}
isc.ListGrid.create({ 
ID: "contactsList", 
left: 800, top: 50, width: 300, 
fields: [
	{name:"salutation", title:"Title"}, 
	{name:"firstname", title:"First Name"}, 
	{name:"lastname", title:"Last Name"}
 ] 
})
//在一个form里面创建页面元素
DynamicForm.create({
    ID:"pane1",
    autoDraw:false,
    titleOrientation:"top",
    itemChange : function (){
        Page.setUnloadMessage("Exiting the page now will lose changes");
    },
	//-----------------------------------------select 下拉框 date 日期 radioGroup单选框 checkbox 多选框 textArea 文本域 button 按钮-------------------------------------------------
    fields:[
        {name:"firstName", title:"姓",editorType:"select",valueMap:["王","李","张"]},
        {name:"lastName", title:"名"},
	
		{name:"birthday",title:"出生年月日",editorType:"date"},		
		{name:"followup",title:"性别",editorType:"radioGroup",valueMap:["猛男","靓女"]},
		{name:"hobby",title:"爱好",editorType:"checkbox"},{name:"hobby",title:"爬山",editorType:"checkbox"},
		{name:"remark",title:"备注",editorType:"textArea",width:250},
		{name:"upload",title:"上传图片",editorType:"upload"},
		{name:"submit",title:"提 交",editorType:"button",width:50,click:"clickBtnClick()"},
		{name:"reset",title:"重 置",editorType:"button",width:50,click:"clickBtnClicked()"}
    ]
});

DynamicForm.create({
    ID:"pane2",
    autoDraw:false,
    titleOrientation:"top",
    itemChange : function () {
        Page.setUnloadMessage("Exiting the page now will lose changes");
    },
    fields:[
        {name:"手机号码:", title:"手机号码"},
        {name:"移动电话", title:"移动电话"},
		{name:"联系地址",title:"地址"},
		{name:"City",title:"所在城市"}
    ]
});

DynamicForm.create({
    ID:"pane3",
    autoDraw:false,
    titleOrientation:"top",
    itemChange : function (){
        Page.setUnloadMessage("Exiting the page now will lose changes");//当用户填写了页面中的内容、关闭该页面的时候,弹出提示框
    },
    fields:[
        {name:"address", title:"家庭住址"},
        {name:"city", title:"所在地址"},
        {name:"state", title:"婚姻状态"},
        {name:"zip", title:"有小孩否"}
    ]
});

isc.History.registerCallback("historyCallback(id)");


isc.Page.setEvent("load", "restoreTabSetState()");

function restoreTabSetState() {
    isc.Log.logWarn("restoring state");
    
    if (!isc.History.haveHistoryState()) {
        tabSet.jumpToTab(isc.History.getCurrentHistoryId() || 0);
    }
}

function historyCallback(id) {
    // the id is the tabNum and null is initial state - which is the first tab.
    tabSet.jumpToTab(id == null ? 0 : id);
}
TabSet.create({
	ID:"tabSet",
	top:50,
	left:180,
	width:600,
	height:400,
    rememberHistory : true,
    jumpToTab : function (tabNum) {
        this.noHistory = true;
      
        this.selectTab(new Number(tabNum));
        this.noHistory = false;
    },
    tabSelected : function (tabNum) {
        if (!this.noHistory && isc.Page.isLoaded()) isc.History.addHistoryEntry(tabNum);
    },
	tabs:[{title:"个人资料", pane:pane1, width:70},
		  {title:"联系方式", pane:pane2, width:70},
		  {title:"隐私秘密", pane:pane3, width:70}
	    ]
});

</script>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值