<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>走马灯效果,向左转还是向右转 </title>
</head>
<script type="text/javascript">
//走马灯向左滚效果
function scrollTitleLeft(){
var title=document.title;
var firstChar=title.charAt(0);
var lastChar=title.substring(1,title.length);
document.title=lastChar+firstChar;
}
//走马灯向右走效果
function scrollTitleRight(){
var title=document.title;
var lastChar=title.charAt(title.length-1);
var firstChar=title.substring(0,title.length-1);
//alert(firstChar);
document.title=lastChar+firstChar;
}
var s=setInterval("scrollTitleLeft()",400);
var flag=true;
var str="scrollTitleLeft()";
/* ===========
走马灯向左关东,同时将按钮设置为暂停效果状态
============*/
function left(){
window.clearInterval(s);
s=window.setInterval("scrollTitleLeft()",400);
str="scrollTitleLeft()";
document.getElementById("stop").value="暂停效果";
}
/* ==========
走马灯向右滚动,同时将按钮设置为暂停效果状态
*=========*/
function right(){
window.clearInterval(s);
s=window.setInterval("scrollTitleRight()",400);
str="scrollTitleRight()";
document.getElementById("stop").value="暂停效果";
}
/* ===========
暂停走马灯。切换按钮暂停效果/重新滚动状态
=============*/
function stop(){
if(flag){
window.clearInterval(s);
document.getElementById("stop").value="重新滚动";
}else{
s=window.setInterval(str,400);
document.getElementById("stop").value="暂停效果";
}
flag=!flag;
}
</script>
<body>
<input type="button" onclick="left()" value="走马灯向左滚动"/>
<input type="button" onclick="right()" value="走马灯向右滚动"/>
<input type="button" onclick="stop()" value="暂停效果" id="stop"/>
</body>
</html>
|
public class Operator {
public static void main(String args[]){
//与 、或、非
boolean a=false;
boolean b=true;
if( a & b){
System.out.println("与需要所有判定条件全部为true");
}
if( a | b){
System.out.println("或只其中有一个为true就为true");
}
//短路与、短语或,与上面的区别是如果前面的条件就足够判断则不进行后面的条件判断
if( a && b){
System.out.println("短路与,若第一个条件为false,则后面条件都不再进行判断");
}
if( a || b){
System.out.println("短路或,第一个条件为true,则后面条件都不再判断");
}
}
}
|
public class HelloWorld {
public static void main(String[] args){
//System.out.println("Hello World");
/* ================
* 基本数据类型:
* byte,short,int,float,double
* char,string
=================*/
System.out.println("byte的最大值"+Byte.MAX_VALUE);
System.out.println("byte的最小值"+Byte.MIN_VALUE);
System.out.println("short的最大值"+Short.MAX_VALUE);
System.out.println("short的最小值"+Short.MIN_VALUE);
System.out.println("int的最大值"+Integer.MAX_VALUE);
System.out.println("int的最小值"+Integer.MIN_VALUE);
System.out.println("float的最大值"+Float.MAX_VALUE);
System.out.println("float的最小值"+Float.MIN_VALUE);
System.out.println("double的最大值"+Double.MAX_VALUE);
System.out.println("double的最小值"+Double.MIN_VALUE);
System.out.println("char的最大值"+(int)Character.MAX_VALUE);
System.out.println("char的最小值"+(int)Character.MIN_VALUE);
}
}
|