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>
            }

  • 相关阅读:
    信息爆炸时代,对待信息的三种方式
    Spring事务管理
    归并排序和快速排序的衍生问题
    Linux之Shell命令
    程序员找工作的干货经验
    css3 Transition动画执行时有可能会出现闪烁的bug
    布尔值
    null, undefined理解
    js文字的无缝滚动(上下)
    vue实现文字上下滚动
  • 原文地址:https://www.cnblogs.com/xlx0210/p/1519928.html
Copyright © 2011-2022 走看看