children( )

MUI HTML5

MUI

children( )

获取Webview窗口的所有子Webview窗口


Array[WebviewObject] wobj.children();
						

说明:

获取添加到Webview窗口中的所有子Webview窗口,如果没有子Webview窗口则返回空数组。

参数:

返回值:

Array[ WebviewObject ] : 包含的子Webview窗口对象数组,没有则返回空数组。

示例:


<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<title>Webview Example</title>
	<script type="text/javascript">
var embed=null;
// H5 plus事件处理
function plusReady(){
	embed=plus.webview.create("http://weibo.com/dhnetwork","",{top:"46px",bottom:"0px"});
	plus.webview.currentWebview().append( embed );
}
if(window.plus){
	plusReady();
}else{
	document.addEventListener("plusready",plusReady,false);
}
// 获取子Webview窗口
function listChildren() {
	var list=plus.webview.currentWebview().children();
	for(var i=0;i<list.length;i++){
		console.log( "Children["+i+"]: "+list[i].getURL() );
	}
}
	</script>
	</head>
	<body>
		获取Webview窗口的所有子Webview窗口
		<button onclick="listChildren()">Children</button>
	</body>
</html>