JavaScriptの中のいくつかの常用方法


<script type="text/javascript">
	
	/**
	 * Document   
	 */
	
	//      
    document.write(document.title);
	
	//     URL
    document.write(document.URL);
	
	//         
	document.write(document.referrer);
	
	//          
	document.wirte(document.anchors.length);
	
	//               
	document.write(document.anchors[0].innerHTML);
	
	//          
	document.write(document.images.length);
	
	/**
	 *             ,JavaScript anchors images               
	 */
	
	/**
	 * Event   
	 */
	
	//         、      
	function whichButton(event) {
		if((event.button & 1) == 1) {
			alert("        ");
		}
		if((event.button & 2) == 2) {
			alert("        ");
		}
		if((event.button & 4) == 4) {
			alert("        ");
		}
	}
	
	//           
	function show_coords(event) {
		x = event.clientX;
		y = event.clientY;
		alert("X coords: " + x + ", Y coords: " + y);
	}
	
	//     Unicode  (     )
	alert(event.keyCode);
	
	//            
	function coordinates(event) {
		x = event.screenX;
		y = event.screenY;
		alert("X = " + x + ", Y = " + y);
	} 
	
	//         
	function coordinates(event) {
		x = event.x;
		y = event.y;
		alert("X = " + x + ", Y = " + y);
	}
	
	/**
	 * Window   
	 */
	
	//         
	window.status = "     ";
	
	//      
	window.resizeBy(-100, -100);
	
	//    
	window.scrollBy(100, 100);
	
	//    、    
	function timedCount() {
		setTimeout("timedCount()", 1000);
	}
	
	function stopCount() {
		clearTimeout(t);
	}
	
	/**
	 * Navigator   
	 */				
	 
	 //          
	 var browser = navigator.appName;
	 var b_version = navigator.appVersion;
	 var version = parseFloat(b_version);		
	 document.write("       : " + browser);
	 document.write("<br />");
	 document.write("   : " + version);
</script>
 
いくつかのよく使う方法は、使う時に調べます.