<head>
</head>
<body>
<SCRIPT language="JavaScript">
var it=0
function initialize(){
mytext=typing.innerText;
typing.innerText='';
typeit();
}
function typeit(){
var myheight=typing.clientHeight;
if (myheight>60){
document.all.typing.style.top=60-myheight;
}
document.all.typing.innerText=document.all.typing.innerText+mytext.charAt(it);
if (it<mytext.length-1){
it++;
setTimeout("typeit()",10);
}
else{
it=0;
typing.innerText='';
document.all.typing.style.top=0;
typeit();
}
}
if (document.all)
document.body.onload=initialize;
</SCRIPT>
<div style="border:blue 1px solid;width:480px;height:60px;overflow:hidden;font-size:12px;">
<span style="position:absolute;" id="typing">
public class StudentTest
{
public static void main(String [] args)
{
Student1 tom = new Student1();
Student2 jack = new Student2();
tom.StudentName("TOM");
tom.StudentNumber("20050204");
jack.StudentName("JACK");
jack.StudentNumber("20050325");
System.out.println("以下代码结果是什么?");
System.out.println("输出结果你就是高手!");
System.out.println(tom.toing());
System.out.println(jack.toing());
System.out.println("恭喜,原来你是真正的高手!!!");
}
}
class Student1
{
private String strName;
private String strNumber;
public String StudentName(String name)
{
strName= name;
return strName;
}
public String StudentNumber(String number)
{
strNumber = number;
return strNumber;
}
public String toing()
{
return ("学生姓名" + strName + "学号" + strNumber);
}
}
class Student2
{
private String strName;
private String strNumber;
public String StudentName(String name)
{
strName= name;
return strName;
}
public String StudentNumber(String number)
{
strNumber = number;
return strNumber;
}
public String toing()
{
return ("学生姓名" + strName + "学号" + strNumber);
}
}
</span>
</div>
</body>
</html>
[此贴子已经被作者于2005-12-18 23:32:16编辑过]