换行的区别,简单的问题 <br />是html的格式,被解析为换行\n换行字符。也就是说一个html标签,一个是字符。不是同一层面的东西。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 下面是.js的文件,3到6行的最后面"<br>\n"和"<br>"有什么区别?谢谢//define the functionsfunction PrintCard(){line1="<b>name: </b>" + this.name + "<br>\n";line2="<b>Address: </b>" + this.address + "<br>\n";line3="<b>Work Phone:</b>" + this.workphone + "<br>\n";line4="<b>Home Phone: </b>" + this.homephone + "<hr>\n";document.write(line1,line2,line3,line4);}function Card(name,address,work,home){ this.name=name; this.address=address; this.workphone=work; this.homephone=home; this.PrintCard=PrintCard; }//Create the objectssue=new Card("Sue Suthers","123 Elm Street","555-1234","555-9876");phred=new Card("Phred Madsen","233 Oak lane","555-2222","555-4444");henry=new Card("Henry Tillman","233 Walnut Circle","555-1299","555-1344");//And print themsue.PrintCard();phred.PrintCard();henry.PrintCard(); line1=" <b>name: </b>" + this.name + " <br>\n"; line2=" <b>Address: </b>" + this.address + " <br>\n"; line3=" <b>Work Phone: </b>" + this.workphone + " <br>\n"; line4=" <b>Home Phone: </b>" + this.homephone + " <hr>\n"; 可以很负责的说,这里的\n没有任何意义。若改成如下:line1=" <b>name: </b>" + this.name + " <br>\n"; line1+=" <b>Address: </b>" + this.address + " <br>\n"; line1+=" <b>Work Phone: </b>" + this.workphone + " <br>\n"; line1+=" <b>Home Phone: </b>" + this.homephone + " <hr>\n"; 这样写还有一点意思,就是在debugger的时候,看line1这个变量中的文本时,可以有换行的效果,这个换行的效果是由\n起作用的。而在页面上的换行是由<br>起作用的OK,放分吧~~~~~ extjs不支持jsf? 请如何给按钮事件使用带参数的处理函数 门外汉提问!希望高手指教! 在线编辑器编辑路径之类的时候,老是把http://dd这段给加上去? 我想要这样一个效果,各位帮帮忙 ie9获得浏览器当前语言环境 我用EXTjs写了一个表格面板,就是数据一直读不出来,高手帮忙看看,急,下面是代码及显示页面 一个已经打开的模式对话框,怎么改变它的窗口大小 各位老大帮帮忙,帮我看看吧,很着急的,我都折腾好久了,网上也找不到相关资料~~~~~:(( cookies的问题:为什么不在同一目录下的文件不能得到COOKIES值? 换行问题 拖放的效果
//define the functions
function PrintCard(){
line1="<b>name: </b>" + this.name + "<br>\n";
line2="<b>Address: </b>" + this.address + "<br>\n";
line3="<b>Work Phone:</b>" + this.workphone + "<br>\n";
line4="<b>Home Phone: </b>" + this.homephone + "<hr>\n";
document.write(line1,line2,line3,line4);
}
function Card(name,address,work,home){
this.name=name;
this.address=address;
this.workphone=work;
this.homephone=home;
this.PrintCard=PrintCard;
}
//Create the objects
sue=new Card("Sue Suthers","123 Elm Street","555-1234","555-9876");
phred=new Card("Phred Madsen","233 Oak lane","555-2222","555-4444");
henry=new Card("Henry Tillman","233 Walnut Circle","555-1299","555-1344");
//And print them
sue.PrintCard();
phred.PrintCard();
henry.PrintCard();
line2=" <b>Address: </b>" + this.address + " <br>\n";
line3=" <b>Work Phone: </b>" + this.workphone + " <br>\n";
line4=" <b>Home Phone: </b>" + this.homephone + " <hr>\n"; 可以很负责的说,这里的\n没有任何意义。
若改成如下:
line1=" <b>name: </b>" + this.name + " <br>\n";
line1+=" <b>Address: </b>" + this.address + " <br>\n";
line1+=" <b>Work Phone: </b>" + this.workphone + " <br>\n";
line1+=" <b>Home Phone: </b>" + this.homephone + " <hr>\n"; 这样写还有一点意思,就是在debugger的时候,看line1这个变量中的文本时,可以有换行的效果,这个换行的效果是由\n起作用的。而在页面上的换行是由<br>起作用的OK,放分吧~~~~~