• HTML学习三


    今天主要学习的为JS和HTML标签的一起使用:

    一、重定向:

    <html>
    	<head>
    		<title>JavaScript1</title>
    	</head>
    	<script type="text/javascript" language="javascript">
    	   function fun(value)
    	   {
    			window.location = value;
    	   }
    	</script>
    	<body>
    	    <select name="url" onchange="fun(this.value)">
    		   <option value="">==select==</option>
    		   <option value="http://www.baidu.com">baidu</option>
    		   <option value="http://www.sohu.com">sohu</option>
    		</select>
    	</body>
    </html>
    

      

    二、全选

    <html>
    	<head>
    		<title>JavaScript2</title>
    		<script type="text/javascript" language="javascript">
    			function funAll()
    			{
    				if(document.all("email").length == undefined )
    				{
    					document.all("email").checked = document.all("selectall").checked;
    				}
    				else
    				{
    					var obj = document.all("email");
    					for( var x=0;x<obj.length;x++)
    					{
    						obj[x].checked = document.all("selectall").checked;
    					}
    				}
    			}
    		</script>
    	</head>
    	<body>
    		<form action="javascript1.html" name="myform">
    			<input type="checkbox" name="email"/>emailA<br/>
    			<input type="checkbox" name="email"/>emailB<br/>
    			<input type="checkbox" name="email"/>emailC<br/>
    			<input type="checkbox" name="email"/>emailD<br/>
    			<hr>
    			<input type="checkbox" name="selectall" onclick="funAll()">selecAll
    		</form>
    	</body>
    </html>
    

      

    三、单选

    <html>
    	<head>
    		<title>JavaScript3</title>
    		<script type="text/javascript" language="javascript">
    			function visitSex()
    			{
    				var obj = document.all("sex");
    				if(obj.length == undefined )
    				{
    					alert(obj.value);
    				}
    				else
    				{
    					if(obj[0].checked)
    					{
    						alert("select is:"+obj[0].value);
    					}else
    					{
    						alert("select is:"+obj[1].value);
    					}
    				}
    			}
    		</script>
    	</head>
    	<body>
    		<input type="radio" name="sex" value="nan" checked="checked"/>man
    		  
    		<input type="radio" name="sex" value="nv" />woman
    		<hr/>
    		<input type="button" value="vistSex" onclick="visitSex()"/>
    	</body>
    </html>
    

      

  • 相关阅读:
    Powerdesigner数据库建模--概念模型--ER图【转】
    oralce闪回
    DBA
    linux socket使用经验总结
    寒假学习笔记1:结构化程序设计
    寒假作业2:简化电梯设计elevator
    鹤发银丝映日月,丹心热血沃新花——忆三位良师
    走廊泼水节
    种树
    P2938 [USACO09FEB]股票市场Stock Market
  • 原文地址:https://www.cnblogs.com/pony1223/p/5579363.html
Copyright © 2020-2023  润新知