javascript新手遇到问题:下面程序错哪里了?字体大小变化的!
<html><head></head><body><scriptlanguage="javascript">varspeed=20;varcycledelay=1000;...
<html>
<head>
</head>
<body>
<script language="javascript">
var speed=20;
var cycledelay=1000;
var maxsize=48;
var thismsg2=new initArray(
"从小到大... ...<br>还会从大到小... ...",
"<a href=#><b><i> 可以加粗加斜加链接... ...</i></b></a>",
"<img src=images/left.gif>还可以加图片:)<img scr=images/right.gif>",
"嘿嘿... ...酷吧!");
var x=0;
var y=0;
var thismsg,size;
var esize="";
function initArray(){
this.length=initArray.arguments.length;
for(var i=0;i<this.length;i++){
this[i]=initArray.arguments[i];
}
}
if(navigator.appName="Netscape")
document.write('<layer id="msgblk"></layer><br>');
if(navigator.appVersion.indexOf("MSIE")!=-1)
document.write('<span id="msgblk"></span><br>');
function big(){
thismsg=thismsg2[y];
if(x<maxsize){
x++;
setTimeout("big()",speed);
}
else setTimeout("small()",cycledelay);
if(navigator.appName="Netscape"){
size="<font point-size=""+x+"pt">";
document.msgblk.document.write(size+"<center>"+thismsg+"</center>"+esize);
document.msgblk.document.close();
}
if(navigator.appVersion.indexOf("MSIE")!=-1){
msgblk.innerHTML="<center>"+thismsg+"</center>";
msgblk.style.fontSize=x+'px';
}
}
function small(){
if(x>1){
x--;
setTimeout("small()",speed);
}
else{
setTimeout("big()",cycledelay);
y++;
if(y>thismsg2.length-1) y=0;
}
if(navigator.appName="Netscape"){
size="<font point-size=""+x+"pt">";
document.msgblk.document.write(size+"<center>"+thismsg+"</center>"+esize);
document.msgblk.document.close();
}
if(navigator.appVersion.indexOf("MSIE")!=-1){
msgblk.innerHTML="<center>"+thismsg+"</center>";
msgblk.style.fontSize=x+'px';
}
}
setTimeout("big()",speed);
</script>
</body>
</html> 展开
<head>
</head>
<body>
<script language="javascript">
var speed=20;
var cycledelay=1000;
var maxsize=48;
var thismsg2=new initArray(
"从小到大... ...<br>还会从大到小... ...",
"<a href=#><b><i> 可以加粗加斜加链接... ...</i></b></a>",
"<img src=images/left.gif>还可以加图片:)<img scr=images/right.gif>",
"嘿嘿... ...酷吧!");
var x=0;
var y=0;
var thismsg,size;
var esize="";
function initArray(){
this.length=initArray.arguments.length;
for(var i=0;i<this.length;i++){
this[i]=initArray.arguments[i];
}
}
if(navigator.appName="Netscape")
document.write('<layer id="msgblk"></layer><br>');
if(navigator.appVersion.indexOf("MSIE")!=-1)
document.write('<span id="msgblk"></span><br>');
function big(){
thismsg=thismsg2[y];
if(x<maxsize){
x++;
setTimeout("big()",speed);
}
else setTimeout("small()",cycledelay);
if(navigator.appName="Netscape"){
size="<font point-size=""+x+"pt">";
document.msgblk.document.write(size+"<center>"+thismsg+"</center>"+esize);
document.msgblk.document.close();
}
if(navigator.appVersion.indexOf("MSIE")!=-1){
msgblk.innerHTML="<center>"+thismsg+"</center>";
msgblk.style.fontSize=x+'px';
}
}
function small(){
if(x>1){
x--;
setTimeout("small()",speed);
}
else{
setTimeout("big()",cycledelay);
y++;
if(y>thismsg2.length-1) y=0;
}
if(navigator.appName="Netscape"){
size="<font point-size=""+x+"pt">";
document.msgblk.document.write(size+"<center>"+thismsg+"</center>"+esize);
document.msgblk.document.close();
}
if(navigator.appVersion.indexOf("MSIE")!=-1){
msgblk.innerHTML="<center>"+thismsg+"</center>";
msgblk.style.fontSize=x+'px';
}
}
setTimeout("big()",speed);
</script>
</body>
</html> 展开
展开全部
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script language="javascript">
var speed=20;
var cycledelay=1000;
var maxsize=48;
var thismsg2=new initArray(
"从小到大... ...<br>还会从大到小... ...",
"<a href=#><b><i> 可以加粗加斜加链接... ...</i></b></a>",
"<img src=images/left.gif>还可以加图片:)<img scr=images/right.gif>",
"嘿嘿... ...酷吧!");
var x=0;
var y=0;
var thismsg,size;
var esize="";
function initArray(){
this.length=initArray.arguments.length;
for(var i=0;i<this.length;i++){
this[i]=initArray.arguments[i];
}
}
if(navigator.appName=="Netscape")
document.write('<layer id="msgblk"></layer><br>');
if(navigator.appVersion.indexOf("MSIE")!=-1)
document.write('<span id="msgblk"></span><br>');
function big(){
thismsg=thismsg2[y];
if(x<maxsize){
x++;
setTimeout("big()",speed);
}
else setTimeout("small()",cycledelay);
if(navigator.appName=="Netscape"){
size="<font point-size=x>";
document.msgblk.document.write(size+"<center>"+thismsg+"</center>"+esize);
document.msgblk.document.close();
}
if(navigator.appVersion.indexOf("MSIE")!=-1){
msgblk.innerHTML="<center>"+thismsg+"</center>";
msgblk.style.fontSize=x+'px';
}
}
function small(){
if(x>1){
x--;
setTimeout("small()",speed);
}
else{
setTimeout("big()",cycledelay);
y++;
if(y>thismsg2.length-1) y=0;
}
if(navigator.appName=="Netscape"){
size="<font point-size=x>";
document.msgblk.document.write(size+"<center>"+thismsg+"</center>"+esize);
document.msgblk.document.close();
}
if(navigator.appVersion.indexOf("MSIE")!=-1){
msgblk.innerHTML="<center>"+thismsg+"</center>";
msgblk.style.fontSize=x+'px';
}
}
setTimeout("big()",speed);
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<script language="javascript">
var speed=20;
var cycledelay=1000;
var maxsize=48;
var thismsg2=new initArray(
"从小到大... ...<br>还会从大到小... ...",
"<a href=#><b><i> 可以加粗加斜加链接... ...</i></b></a>",
"<img src=images/left.gif>还可以加图片:)<img scr=images/right.gif>",
"嘿嘿... ...酷吧!");
var x=0;
var y=0;
var thismsg,size;
var esize="";
function initArray(){
this.length=initArray.arguments.length;
for(var i=0;i<this.length;i++){
this[i]=initArray.arguments[i];
}
}
if(navigator.appName=="Netscape")
document.write('<layer id="msgblk"></layer><br>');
if(navigator.appVersion.indexOf("MSIE")!=-1)
document.write('<span id="msgblk"></span><br>');
function big(){
thismsg=thismsg2[y];
if(x<maxsize){
x++;
setTimeout("big()",speed);
}
else setTimeout("small()",cycledelay);
if(navigator.appName=="Netscape"){
size="<font point-size=x>";
document.msgblk.document.write(size+"<center>"+thismsg+"</center>"+esize);
document.msgblk.document.close();
}
if(navigator.appVersion.indexOf("MSIE")!=-1){
msgblk.innerHTML="<center>"+thismsg+"</center>";
msgblk.style.fontSize=x+'px';
}
}
function small(){
if(x>1){
x--;
setTimeout("small()",speed);
}
else{
setTimeout("big()",cycledelay);
y++;
if(y>thismsg2.length-1) y=0;
}
if(navigator.appName=="Netscape"){
size="<font point-size=x>";
document.msgblk.document.write(size+"<center>"+thismsg+"</center>"+esize);
document.msgblk.document.close();
}
if(navigator.appVersion.indexOf("MSIE")!=-1){
msgblk.innerHTML="<center>"+thismsg+"</center>";
msgblk.style.fontSize=x+'px';
}
}
setTimeout("big()",speed);
</script>
</body>
</html>
更多追问追答
追问
size="";
为什么要用这个point-size=x;point没有看到定义有啊!
追答
语法问题,不这么写的话会报错,就跑不下去了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询