zoukankan      html  css  js  c++  java
  • 用Javascript获取select的值 yangan

     <script type="text/javascript">
     function GetValue()
     {
      var strUrl;  
      strUrl=window.document.getElementById("friendLink").value;
      
      window.open("http://22+strurl/);  
       
     }
    </script>

    //根据链接类型读取数据库中的数据

            public static string GetLink(string type)
            {
                string sqlTemp = "select * from shang_cms_friends where lianjie_pic ='" + type + "'";
                DataSet ds = SQLHelper.DataAdapter(sqlTemp, SQLHelper.SDACmd.select, "sqlIndex");

                string link = null;
                string strSelectStart = "<select id=friendLink name=friendLink style=275px;height:27px; onChange=javascript:GetValue(); >";
                if (type == "0")
                {
                    link = strSelectStart + "<option selected=selected>--------友情链接--------</option>";
                }
                else
                {
                    link = strSelectStart + "<option selected=selected>--------子公司链接--------</option>";
                }

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {

                    link += "<option value="+ds.Tables[0].Rows[i]["lianjie_url"].ToString()+">" + ds.Tables[0].Rows[i]["lianjie_name"].ToString() + "</option>";
                }

                link += "</select>";

                return link;

               // <select id="friendLink" name="friendLink" style=" 275px; height: 27px;">
                 //       <option selected="selected">--------友情链接--------</option>
                 //   </select>
            }

  • 相关阅读:
    ojdbc15-10.2.0.4.0.jar maven 引用报错 Dependency 'com.oracle:ojdbc15:10.2.0.4.0' not found
    两个js文件之间函数互调问题
    Win10连接远程桌面时提示“您的凭据不工作”
    Examples_08_03
    ant打包命令
    SVN版本日志对话框命令使用指南
    activiti_SpringEnvironment
    shell脚本
    python爬虫
    php正则表达式总结
  • 原文地址:https://www.cnblogs.com/xlx0210/p/1519928.html
Copyright © 2011-2022 走看看