• 移动列表内容


    <style type="text/css">
    *{ margin:0px auto; padding:0px}
    #wai{ 500px; height:500px}
    #left{ 200px; height:500px; float:left}
    #zhong{ 100px; height:500px; float:left}
    #right{ 200px; height:500px; float:left}
    </style>
    </head>
    
    <body>
    <br />
    <div id="wai">
    	<div id="left">
        	<select style="200px; height:300px" id="selleft" multiple="multiple">
            	<option value="山东">山东</option>
                <option value="淄博">淄博</option>
                <option value="张店">张店</option>
            </select>
        </div>
        <div id="zhong">
        	<div style="margin-left:10px; margin-top:20px">
            <input style="60px; height:30px" type="button" value=">>" onclick="moveall()" />
            </div>
          
            <div style="margin-left:10px; margin-top:30px">
            <input style="60px; height:30px" type="button" value=">" onclick="moveone()" />
            </div>
        </div>
    	<div id="right">
        	<select id="selright" multiple="multiple" style="200px; height:300px"></select>
        </div>
    </div>
    
    
    <script type="text/javascript">
    
    function moveone()
    {
    	var left = document.getElementById("selleft");
    	var right = document.getElementById("selright");
    	
    	var xz = left.value;
    	var str = "<option value='"+xz+"'>"+xz+"</option>";
    	//判断
    	//alert(right.childNodes.item(0));
    	var bs = 0;
    	for(var i=0;i<right.childNodes.length;i++)
    	{
    		if(right.childNodes.item(i).text==xz)
    		{
    			bs = 1;
    		}
    	}
    	
    	if(bs==0)
    	{
    		//追加
    		right.innerHTML = right.innerHTML+str;
    	}
    }
    
    function moveall()
    {
    	var left = document.getElementById("selleft");
    	var right = document.getElementById("selright");
    	
    	right.innerHTML = left.innerHTML;
    }
    
    </script>
    

      年月日的选择

    <body>
    
    <select id="nian" onclick="biantian()"></select><select id="yue" onclick="biantian()"></select><select id="tian"></select><script type="text/javascript">
    FillNian();
    FillYue();
    FillTian();
    function FillNian()
    {
        var b = new Date(); //获取当前时间
        var nian = parseInt(b.getFullYear());
        
        var str = "";
        
        for(var i=nian-5;i<nian+6;i++)
        {
            str = str+"<option value='"+i+"'>"+i+"</option>";
        }
        
        document.getElementById("nian").innerHTML = str;
        
    }
    
    function FillYue()
    {
        var str = "";
        for(var i=1;i<13;i++)
        {
            str = str+"<option value='"+i+"'>"+i+"</option>";
        }
        document.getElementById("yue").innerHTML = str;
    }
    
    function FillTian()
    {
        var yue = document.getElementById("yue").value;
        var nian = document.getElementById("nian").value;
        var ts = 31;
        
        if(yue==4 || yue==6 || yue==9 || yue==11)
        {
            ts=30;
        }
        
        if(yue==2)
        {
            if((nian%4==0 && nian%100 != 0) || nian%400==0)
            {
                ts = 29;
            }
            else
            {
                ts = 28;
            }
        }
        
        var str = "";
        for(var i=1;i<ts+1;i++)
        {
            str = str+"<option value='"+i+"'>"+i+"</option>";
        }
        document.getElementById("tian").innerHTML = str;
    
        
        
    }
    
    
    function biantian()
    {
        FillTian();
    }
    </script>
    </body>
  • 相关阅读:
    网络抓包工具使用
    JAVA 原子操作类
    guava collection/cache初探
    MiniGUI
    Cookie
    System V IPC
    SQLite交叉编译
    NCurses交叉编译
    双向循环链表
    VMware安装Windows Server 2008
  • 原文地址:https://www.cnblogs.com/1358-com/p/6101392.html
Copyright © 2020-2023  润新知