01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<
html
>
<
head
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=UTF-8"
>
<
title
>联系人列表</
title
>
<
script
type
=
"text/javascript"
>
//我们传入的jsondata是一个数组如:
//[{id:20,name:"王昌龙",phone:"18701445755"},......] 这样
function show(jsondata){
var jsonobjs = eval(jsondata);
var table = document.getElementById("personTable");
for(var y=0; y<
jsonobjs.length
; y++){
var
tr
=
table
.insertRow(table.rows.length); //添加一行
tr.onmouseover
=
function
(){
this.style.backgroundColor
=
"red"
;
}
tr.onmouseout
=
function
(){
this.style.backgroundColor
=
"#000000"
;
}
//添加三列
var
td1
=
tr
.insertCell(0);
var
td2
=
tr
.insertCell(1);
td2.align
=
"center"
;
var
td3
=
tr
.insertCell(2);
//设置列内容和属性
td1.innerHTML
=
jsonobjs
[y].id;
//转义
td2.innerHTML
=
"<a href='javascript:partner4java.call(\"
5554\")'>"+ jsonobjs[y].name + "</
a
>";
td3.innerHTML = jsonobjs[y].phone;
}
}
function init(){
var jsondata = "[{id:20,name:\"王昌龙\",phone:\"18701445755\"},{id:21,name:\"幻云\",phone:\"18701445755\"}]";
show(jsondata);
}
</
script
>
</
head
>
<
body
bgcolor
=
"#000000"
text
=
"#FFFFFF"
style
=
"margin:0 0 0 0"
>
联系人列表
<
table
border
=
"0"
width
=
"100%"
id
=
"personTable"
cellspacing
=
"0"
>
<
tr
>
<
td
width
=
"15%"
>编号</
td
><
td
align
=
"center"
>姓名</
td
><
td
width
=
"15%"
>电话</
td
>
</
tr
>
</
table
>
</
body
>
</
html
>
|
01
02
03
04
05
06
07
08
09
10
11
12
|
private
WebView myWeb;
myWeb=(WebView)findViewById(R.id.myWeb);
urlWeb=(WebView)findViewById(R.id.urlWeb);
myWeb.getSettings().setJavaScriptEnabled(
true
);
//不保存表单数据
myWeb.getSettings().setSaveFormData(
false
);
//不保存密码
myWeb.getSettings().setSavePassword(
false
);
//不支持页面放大功能
myWeb.getSettings().setSupportZoom(
false
);
//显示页面
myWeb.loadUrl(
"file:///android_asset/index.html"
);
|
01
02
03
04
05
|
private
WebView urlWeb;
urlWeb.getSettings().setJavaScriptEnabled(
true
);
urlWeb.getSettings().setSaveFormData(
true
);
urlWeb.getSettings().setSavePassword(
true
);
urlWeb.loadUrl(
"http://www.eoeandroid.com/forum.php"
);
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
|
<
LinearLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
xmlns:tools
=
"http://schemas.android.com/tools"
android:layout_width
=
"fill_parent"
android:layout_height
=
"fill_parent"
android:orientation
=
"vertical"
>
<
WebView
android:id
=
"@+id/myWeb"
android:layout_width
=
"fill_parent"
android:layout_height
=
"wrap_content"
/>
<
WebView
android:id
=
"@+id/urlWeb"
android:layout_width
=
"fill_parent"
android:layout_height
=
"fill_parent"
/>
</
LinearLayout
>
|