U.School.htm 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title></title>
  5. <meta http-equiv="content-type" content="text/html;charset=utf-8">
  6. <!--1473基础js类-->
  7. <script src="http://www.1473.cn/js/UC/UC23.js" type="text/javascript"></script>
  8. <script src="http://nodejs.1473.cn/crossdomain.js" type="text/javascript"></script>
  9. <script src="http://nodejs.1473.cn/js/UCity/U.City.js" type="text/javascript"></script>
  10. <link href="http://nodejs.1473.cn/css/UCity/U.City.css" rel="stylesheet" type="text/css" />
  11. <script type="text/javascript">
  12. Namespace.register("U.School"); //命名空间
  13. var City = new U.CityT(); //调用地区控件
  14. window.onload = function () {
  15. U.CD.Host = "192.168.100.61"; //需要更换数据库host,在这里更换
  16. U.CD.Database = "UseStudio_CityS"; //需要更换数据库名字,在这里更换
  17. U.CD.Init(); //初始化跨域文件
  18. //其他初始化写在下面
  19. //U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "UC_S_Select_Sta", '0']), U.Exam.aa_asyn, (["", "bb"]));
  20. //---------------------------db 为数据库名字, r为 存储过程函数, val为该存储过程的参数 若没有参数可以不传 若有多个参数采用数组的方法,
  21. //-----------------------------------------------------------------------------------例如传入 [a,b] 查看下面 div文本为北京的元素
  22. U.School($("#aa")[0], $("#qq")[0]);
  23. }
  24. var City = new U.CityT(); //调用地区控件
  25. Namespace.register("U.School"); //自定义回话框等区域
  26. U.School = function (Udiv, Uit) {
  27. var _UT = new U.SchoolT(Udiv);
  28. _UT.init();
  29. return _UT;
  30. }
  31. U.SchoolT = function (Udiv, Uit) {
  32. this.Udiv = Udiv;
  33. this.Uit = Uit;
  34. }
  35. U.SchoolT.prototype = {
  36. init: function () {
  37. this.Odiv();
  38. this.sumbit(this.Uit);
  39. },
  40. Odiv: function () {
  41. this.winWidth = document.body.offsetWidth
  42. var U_S_Out = $$("div", { "id": "U_S_Out", "className": "U_C_Out" }, this.Udiv);
  43. var U_S_O_L = $$("div", { "id": "U_S_O_L", "className": "U_C_O_L U_C_left", "innerHTML": "教育信息:" }, U_S_Out);
  44. var U_S_O_R = $$("div", { "id": "U_S_O_R", "className": "U_C_O_R U_C_right" }, U_S_Out);
  45. var U_S_O_C = $$("div", { "id": "U_S_O_C", "className": "U_C_O_C U_C_left", "innerHTML": "未填写教育信息" }, U_S_O_R);
  46. var U_S_O_R_D = $$("div", { "id": "U_S_O_R_D", "className": "U_C_O_R_T U_C_right", "innerHTML": "编辑", "onclick": [[this.view, ([this])]] }, U_S_O_R);
  47. },
  48. view: function (_this) {
  49. var r = U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "US_S_Select_place"]), "", (["", "bb", _this]));
  50. var U_S_Out = $("#U_S_Out").animate({ "height": "100px" }, 200);
  51. var U_S_Content = $$("div", { "id": "U_S_Content", "className": "U_S_Content" }, U_S_Out);
  52. var U_S_O_R = $("#U_S_O_R")[0];
  53. $("#U_S_O_R_D")[0].style.display = "none";
  54. $("#U_S_O_C")[0].style.display = "none";
  55. $$("div", { "id": "U_S_O_R_P", "className": "U_C_O_R_T U_C_right", "innerHTML": "收起", "onclick": [[City.pickup, ([U_S_Content, "S"])]] }, U_S_O_R);
  56. $$("div", { "id": "U_S_O_R_Remind", "className": "U_C_O_R_Remind", "innerHTML": "填写教育信息,能帮助你在微博上快速找到许久不见的老同学" }, U_S_Content)
  57. var U_S_Content_D = $$("div", { "id": "U_S_Content_D", "className": "U_S_Content_D" }, U_S_Content);
  58. $$("div", { "innerHTML": "学校名称", "className": "U_S_T_right U_C_left", "style": { "width": "55px"} }, U_S_Content_D);
  59. var U_S_icon = $$("div", { "id": "U_S_icon", "className": "U_S_icon" }, U_S_Content_D)
  60. var U_S_input = $$("input", { "className": "U_S_input", "type": "text", "id": "U_S_input", "placeholder": "点击选择学校", "onclick": [[_this.place, ([r])]] }, U_S_icon)
  61. if (_this.value) {
  62. U_S_input.value = _this.value;
  63. }
  64. },
  65. place: function (r) {
  66. $("#U_S_input")[0].blur();
  67. var U_S_N_D = $$("div", { "id": "U_S_N_D", "className": "U_S_N_D", "style": { "width": US.Width + "px", "height": US.Height + "px"} }, $("body")[0])
  68. var U_S_N_B = $$("div", { "id": "U_S_N_B", "className": "U_S_N_B", "style": { "left": (US.Width - 860) / 2 + "px", "top": (US.Height - 392) / 2 + "px"} }, $("body")[0]);
  69. var U_S_Title = $$("div", { "className": "U_S_Title" }, U_S_N_B)
  70. $$("div", { "innerHTML": "选择学校", "title": "选择学校", "className": "U_C_left" }, U_S_Title);
  71. $$("div", { "id": "U_S_B_Close", "className": "U_S_B_Close U_C_right", "onclick": [[City.destroy, (["", [U_S_N_D, U_S_N_B]])]], "innerHTML": "×" }, U_S_Title)
  72. var U_S_B = $$("div", { "id": "U_S_B", "className": "U_S_B" }, U_S_N_B);
  73. var U_S_B_L_T = $$("div", {}, U_S_B);
  74. $$("div", { "innerHTML": "城市选择:", "className": "U_S_color U_C_left" }, U_S_B_L_T);
  75. $$("div", { "innerHTML": "学校选择:", "className": "U_S_color U_C_left", "style": { "margin-left": "190px"} }, U_S_B_L_T);
  76. var U_S_B_L = $$("div", { "id": "U_S_B_L", "className": "U_S_B_L U_C_left" }, U_S_B);
  77. var U_S_B_L_Pro = $$("div", {}, U_S_B_L)
  78. for (var i = 0; i < r.value[0].length; i++) {
  79. var U_S_Select = $$("div", { "id": "U_S_Select_" + i, "className": "U_S_Select U_C_left U_C_Select", "innerHTML": r.value[0][i].place, "onclick": [[r.context[2].call, ([[r.value[0][i].place, r.context[2], "U_S_Select_" + i]])]] }, U_S_B_L_Pro)
  80. if (r.value[0][i].place == r.context[2].area) {
  81. U_S_Select.style.border = "1px solid #A6A1A1";
  82. }
  83. }
  84. var U_S_B_L_Text = $$("div", { "id": "U_S_B_L_Text", "className": "U_S_B_L_Text" }, U_S_B_L);
  85. var U_S_B_L_Nofind = $$("div", { "innerHTML": "找不到我学校?", "className": "U_C_M_B_Text U_S_B_L_Nofind" }, U_S_B_L_Text);
  86. var U_S_B_L_input = $$("input", { "id": "U_S_B_L_input", "className": "U_C_B_L_input U_S_B_L_input", "placeholder": "例子:广东-深圳技师学院", "type": "text" }, U_S_B_L_Text)
  87. var U_S_B_L_submit = $$("div", { "id": "U_S_B_L_submit", "className": "U_S_B_L_submit" }, U_S_B_L_Text)
  88. var U_S_B_L_submit_t = $$("div", { "innerHTML": "确定", "onclick": [[r.context[2].YOrF, ([U_S_B_L_input, r])]] }, U_S_B_L_submit)
  89. U_S_B_L_Nofind.onclick = function () { U_S_B_L_input.focus() }
  90. var U_S_B_R = $$("div", { "id": "U_S_B_R", "className": "U_S_B_R U_C_left" }, U_S_B);
  91. var a = r.context[2].area ? r.context[2].area : "北京";
  92. U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "US_S_Select_school", a]), r.context[2].school, (["", "bb", r.context[2], "北京"]));
  93. },
  94. call: function (r) {
  95. for (var i = 0; i < 33; i++) {
  96. $("#U_S_Select_" + i)[0].className = "U_S_Select U_C_left U_C_Select";
  97. }
  98. $("#" + r[2])[0].className = "U_S_Select U_C_left border U_C_Select";
  99. U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "US_S_Select_school", r[0]]), r[1].school, (["", "bb", r]));
  100. },
  101. YOrF: function (str, r) {
  102. var S = str.value.split("-");
  103. var flg = false;
  104. var reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
  105. if (S.length != 2) { alert("填下信息有错,例子:广东-深圳技师学院"); return; }
  106. for (var i = 0; i < r.value[0].length; i++) {
  107. if (r.value[0][i].place == S[0]) { flg = true; break; }
  108. }
  109. if (flg == true) {
  110. if (reg.test(S[1])) {
  111. r.context[2].result([S[1], S[0], r.context[2]]);
  112. }
  113. } else { alert("输入的省份有错"); }
  114. },
  115. school: function (r) {
  116. U_S_B_R.innerHTML = "";
  117. var city, _this;
  118. r.context[3] != undefined ? city = r.context[3] : city = r.context[2][0];
  119. r.context[2][1] != undefined ? _this = r.context[2][1] : _this = r.context[2];
  120. for (var k = 0; k < r.value[0].length; k++) {
  121. $$("div", { "id": "U_S_School_" + k, "className": "U_S_School U_C_left", "innerHTML": r.value[0][k].name, "onclick": [[_this.result, ([[r.value[0][k].name, city, _this]])]] }, U_S_B_R);
  122. }
  123. },
  124. result: function (r) {
  125. $("#U_S_N_B")[0].parentNode.removeChild($("#U_S_N_B")[0]);
  126. $("#U_S_N_D")[0].parentNode.removeChild($("#U_S_N_D")[0]);
  127. r[2].area = r[1];
  128. $("#U_S_input")[0].value = r[2].value = r[0];
  129. $("#U_S_O_C")[0].innerHTML = r[0];
  130. },
  131. sumbit: function (Uit) { //这里是返回一个数组, 数组的值是用户选择的值
  132. if (Uit == undefined) {
  133. return;
  134. }
  135. Uit.onclick = (function (that) {
  136. return function () {
  137. alert(that.value);
  138. }
  139. })(this)
  140. }
  141. }
  142. </script>
  143. </head>
  144. <body>
  145. <div id="aa" style="width: 30%; height: 790px; position: absolute; left: 50px; top: 10px">
  146. </div>
  147. <div id="qq" style="width: 100px; height: 100px; background-color: red; position: absolute;
  148. top: 300px">
  149. </div>
  150. </body>
  151. </html>