在云那方

首页 新随笔 联系 订阅 管理

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript">
   
  //显示层
  function BranchNo_ShowDiv(value)
  {
   var div = document.getElementById("BranchNo_forpopdiv");
   div.innerHTML = BranchNo_html;
   var address = document.getElementsByName("BranchNo_address");
   for(var i=0;i<address.length;i++)
   {
    if(address[i].innerHTML == value)
    {
     address[i].className = "currcity";
     break;
    }
   }

   BranchNo_pop.document.body.innerHTML = "";
   BranchNo_pop.document.write('<body scroll=auto>');
   BranchNo_pop.document.write('<style>a:link { color: black; text-decoration: none} \n a:visited { color: black; text-decoration: none} \n a:active { color: #800080; text-decoration: underline} A:hover{background-color: gray;color:#ffffff;text-decoration: underline} \n a.currcity:link { color: blue;font-weight:bold; text-decoration: none} \n   a.currcity:visited { color: blue;font-weight:bold; text-decoration: none} \n   A.currcity:hover{background-color: gray;font-weight:bold;color:#ffffff;text-decoration: underline}</style>');
   BranchNo_pop.document.write(div.innerHTML);
   BranchNo_pop.document.write('</body>');
   BranchNo_pop.document.body.style.backgroundColor = "#F2F9FF";
   BranchNo_pop.document.body.style.border = "solid gray 1px";

   var textInput = document.getElementById("BranchNo_tbxAddress");
   BranchNo_pop.show(0,textInput.offsetHeight,BranchNo_gpopwidth,300,textInput);
  }
  
  //隐藏层
  function BranchNo_HideDiv(value,no)
  {
   var text = document.getElementById("BranchNo_tbxAddress");
   text.value = value;
   BranchNo_pop.hide();
  }
  
  //全局变量
  var BranchNo_dataSource = [["B",["0010","北京"],["0472","包头"]],["C",["0023","重庆"],["0028","成都"],["0731","长沙"],["0519","常州"],["0431","长春"]],["D",["0411","大连"],["0769","东莞"],["0415","丹东"]],["E",["0477","鄂尔多斯"]],["F",["0591","福州"],["0757","佛山"],["0413","抚顺"]],["G",["0020","广州"]],["H",["0571","杭州"],["0551","合肥"],["0451","哈尔滨"],["0714","黄石"],["0471","呼和浩特"]],["J",["0531","济南"],["0579","金华"],["0573","嘉兴"],["0613","江都"],["0792","九江"]],["K",["0871","昆明"]],["L",["0931","兰州"]],["N",["0025","南京"],["0791","南昌"],["0574","宁波"],["0513","南通"],["0771","南宁"]],["P",["0427","盘锦"]],["Q",["0532","青岛"],["0595","泉州"]],["R",["0587","瑞安"],["0633","日照"]],["S",["0755","深圳"],["0021","上海"],["0024","沈阳"],["0512","苏州"],["0575","绍兴"]],["T",["0022","天津"],["0351","太原"],["0576","台州"]],["W",["0027","武汉"],["0991","乌鲁木齐"],["0510","无锡"],["0577","温州"],["0536","潍坊"]],["X",["0029","西安"],["0592","厦门"],["0732","湘潭"]],["Y",["0717","宜昌"],["0535","烟台"],["0514","扬州"],["0610","宜兴"]],["Z",["0371","郑州"],["0733","株洲"]]];
  var BranchNo_pop = window.createPopup();
  var BranchNo_html;
  var BranchNo_gpopwidth;
  
  //层数据加载
  function BranchNo_Init()
  {
   var dataSource = BranchNo_dataSource;
   var html = "<style>A:hover{background-color: gray;}</style>"
   html += "<table style='FONT-SIZE: 12px; LINE-HEIGHT: 16px' width='100%'><tr>";
   var currColumnSize =0;
   var colunns = 0;
   for(var i=0;i<dataSource.length;i++)
   {
    var currSeries = dataSource[i];
    if(currColumnSize>=10 && currColumnSize+currSeries.length+1>12)
    {
     html += "</td>"
     currColumnSize = 0;
    }
    if(currColumnSize==0)
    {
     html += "<td vAlign=\"top\" align=\"center\">";
     colunns++;
    }else
    {
     html += "<br>";
     currColumnSize++;
    }
    
    for(var j=0;j<currSeries.length;j++)
    {
     if(currColumnSize!=0)
      html += "<br>";
     if(j==0)
      html += "<span style=\"color:red;FONT-Family:'Times New Roman';FONT-WEIGHT: bold;font-size:12px\">"+currSeries[j]+"</span>";
     else
      html += "<a name='BranchNo_address' href='#'  onclick=\"parent.BranchNo_HideDiv('" + currSeries[j][1] +"','" + currSeries[j][0] +"');return false;\">" + currSeries[j][1] + "</a>";
     currColumnSize++;
    }
   }
   
   html += "</td></tr></table>";
   BranchNo_html = html;
   BranchNo_gpopwidth =60*colunns;
   var popBody = BranchNo_pop.document.body;
   popBody.style.backgroundColor = "#F2F9FF";
   popBody.style.border = "solid gray 1px";
   popBody.style.overflow = "auto";
  }
  BranchNo_Init();
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="BranchNo_forpopdiv" style="DISPLAY: none"></div>
    <input type="text" id="BranchNo_tbxAddress" onfocus="BranchNo_ShowDiv(this.value)" onclick="BranchNo_ShowDiv(this.value)" readonly="readonly"
    style="width:160px;BACKGROUND-POSITION:right bottom;BACKGROUND-REPEAT:no-repeat;BACKGROUND-IMAGE:url(dropbg.GIF);" />
    </form>
</body>
</html>

posted on 2009-02-09 11:17  Rich.T  阅读(234)  评论(0编辑  收藏  举报