浏览代码

搜索页面跳转软键盘问题

luyanan 8 年之前
父节点
当前提交
909706f178
共有 3 个文件被更改,包括 23 次插入31 次删除
  1. 2 2
      app/html/professorArticle.html
  2. 1 0
      app/js/searchListNew.js
  3. 20 29
      app/js/searchfirst.js

+ 2 - 2
app/html/professorArticle.html

9
		<link href="../css/iconfont.css" rel="stylesheet" />
9
		<link href="../css/iconfont.css" rel="stylesheet" />
10
		<link href="../css/app.css" rel="stylesheet" />
10
		<link href="../css/app.css" rel="stylesheet" />
11
		<style>
11
		<style>
12
			/*html,body{height: 100%;margin:0;padding:0px;overflow: hidden;background: #FFFFFF;}*/
13
			.mui-content{height:100%;overflow: auto;background: #FFFFFF;}
12
			html,body{height: 100%;margin:0;padding:0px;overflow: hidden;background: #FFFFFF;}
13
			.mui-content{min-height:100%;overflow: auto;background: #FFFFFF;}
14
		</style>
14
		</style>
15
	</head>
15
	</head>
16
16

+ 1 - 0
app/js/searchListNew.js

397
			}, "get", search.resource);
397
			}, "get", search.resource);
398
		} else if(this.innerHTML == "找专家") {
398
		} else if(this.innerHTML == "找专家") {
399
			document.getElementById("sele").style.display = "block";
399
			document.getElementById("sele").style.display = "block";
400
			document.getElementById("searB").classList.add("searchboxNewT");
400
			qiFlag = 1;
401
			qiFlag = 1;
401
			search.oAjaxGet(baseUrl + "/ajax/professor/pqAPP", {
402
			search.oAjaxGet(baseUrl + "/ajax/professor/pqAPP", {
402
				"key": document.getElementById("searchval").value,
403
				"key": document.getElementById("searchval").value,

+ 20 - 29
app/js/searchfirst.js

1
mui.plusReady(function() {
1
mui.plusReady(function() {
2
	document.getElementById("searchval").focus()
3
	if(mui.os.ios) {
4
		var webView = plus.webview.currentWebview().nativeInstanceObject();
5
		webView.plusCallMethod({
6
			"setKeyboardDisplayRequiresUserAction": false
7
		});
8
	} else {
9
		var webview = plus.android.currentWebview();
10
		plus.android.importClass(webview);
11
		webview.requestFocus();
12
		var Context = plus.android.importClass("android.content.Context");
13
		var InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");
14
		var main = plus.android.runtimeMainActivity();
15
		var imm = main.getSystemService(Context.INPUT_METHOD_SERVICE);
16
		imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
17
	}
18
	var fff=1;
19
	document.getElementById("searchval").addEventListener("blur",aa,false);
20
	function aa() {
21
		if(fff==1) {
22
			this.focus();
23
			fff=0;
24
			this.blur()
25
		}
26
		document.getElementById("searchval").removeEventListener("blur",aa,false);
27
	}
2
//document.getElementById("searchval").focus()
3
//	if(mui.os.ios) {
4
//		var webView = plus.webview.currentWebview().nativeInstanceObject();
5
//		webView.plusCallMethod({
6
//			"setKeyboardDisplayRequiresUserAction": false
7
//		});
8
//	} else {
9
//		var webview = plus.android.currentWebview();
10
//		plus.android.importClass(webview);
11
//		webview.requestFocus();
12
//		var Context = plus.android.importClass("android.content.Context");
13
//		var InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");
14
//		var main = plus.android.runtimeMainActivity();
15
//		var imm = main.getSystemService(Context.INPUT_METHOD_SERVICE);
16
//		imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
17
//	}
18
	
28
	var search = {
19
	var search = {
29
		oAjaxGet: function(url, obj, oType, oFun) {
20
		oAjaxGet: function(url, obj, oType, oFun) {
30
			mui.ajax(url, {
21
			mui.ajax(url, {
59
			}
50
			}
60
		},
51
		},
61
		createWin: function(keyValue) {
52
		createWin: function(keyValue) {
53
			document.activeElement.blur();
62
			mui.openWindow({
54
			mui.openWindow({
63
				url: '../html/searchListNew.html',
55
				url: '../html/searchListNew.html',
64
				id: '../html/searchListNew.html',
56
				id: '../html/searchListNew.html',
71
					qiFlag: 1
63
					qiFlag: 1
72
				}
64
				}
73
			});
65
			});
66
			
74
		}
67
		}
75
	}
68
	}
76

69

81
	});
74
	});
82

75

83
	/*按键字搜索*/
76
	/*按键字搜索*/
84
	document.getElementById("searchval").addEventListener("keyup", function() {
85
		var e = event || window.event || arguments.caller.arguments[0];
77
	document.getElementById("searchval").addEventListener("keyup", function(e) {
86
		if(e.keyCode == 13) {
78
		if(e.keyCode == 13) {
87
			search.createWin(this.value);
79
			search.createWin(this.value);
88

89
		}
80
		}
90
	})
81
	})
91

82