//创建简单Web窗体
import console;
import web.form;
/*DSG{{*/
var winform = win.form(parent=...; bottom=451;scroll=1;text="AAuto Form";right=681 )
winform.add(  )
/*}}*/

//创建web窗体
var wb = web.form( winform, , , ,true/*securityTrusted*/  )
 
wb.external={
	log = function(...){
		console.log(...) 
	}
	tab = {abc=1;b=2};
	array = {1;2;3} 
} 

var html = /**
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
	
	<script type="text/javascript">
	console = {};
	console.log = function () {
	    for (var i = 0; i < arguments.length; i++) {  
	    	if( typeof(arguments[i])!="undefined" && typeof(arguments[i])!="null"    )
	        	arguments[i] =  arguments[i].toString() 
	        else 
	        	arguments[i] =  typeof (arguments[i]);
		}
		Array.prototype.splice.call(arguments, 0, 0, external, 'Javascript console:');
		Function.call.apply(external.log, arguments);
	};  
	$enum = function(obj,callback,thisObj){
	 
		if( obj instanceof Array ){
			for(var i=0;i<obj.length;i++){
				callback.call(thisObj||window,i,obj[i],obj);  
			}
		}
		else if( obj instanceof Object ){
			for( k in obj){
				callback.call(thisObj||window,k,obj[k],obj); 
			}
		}
		else{
			if(typeof(obj)=="unknown"){
				var array = new VBArray(obj).toArray()
				for (var i = 0; i < array.length; i++) {
					callback.call(thisObj||window,i,array[i],array );
				}
			}
			else if( obj ) { 
				var e = new Enumerator(obj);  
				var k;
				if(!e)
					return;
				
				for   (;!e.atEnd();e.moveNext()){ 
					k = e.item(); 
					callback.call(thisObj||window,k,obj[k],obj); 
				} 
			}
		} 
	}  
	</script>
	
	<script type="text/javascript">
	//其他Js代码
	
	</script>
	
	<style type="text/css">
    body { 
        font: 10.5pt/1.3;
    }
    </style> 
</head>
<body>
	<div id="myId">  
		click me!
	</div>
</body>
</html>
**/ 
wb.write( html ) 
  
var js = /**
	console.log( "Hello,AAuto!" )
	console.log( "Welcome to AAuto!",event.srcElement.id );
	//枚举js数组
	$enum(
		[1,2,3],
		function(v,i){
			console.log(v,i)
		}
	)
	//枚举js对象
	$enum(
		{a:123,b:456},
		function(k,v){
			console.log(k,v)
		}
	)
	//枚举AAuto数组
	$enum(
		external.array,
		function(k,v){
			console.log(k,v)
		}
	)
	//枚举AAuto对象
	$enum(
		external.tab,
		function(k,v){
			console.log(k,v)
		}
	)
**/
wb.eventScript(js,"myId","onclick")

winform.show(); 

//进入消息循环
win.loopMessage(); 
