<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>document.write</title>
<script type="text/javascript">
var myname="我是"
document.write(myname+"<br/>""小可爱")
document.write("你的")
</script>
</head>
<body>
</body>
</html>
小可爱写在br后面就没有反应了,但是写在br前面就有用
document.write(myname+"小可爱"+"<br/>")
document.write(myname+"<br/>"+"小可爱")这样试试,就可以了
楼上正解
连接字符串
<script type="text/javascript">
var mystr="我是";
var mychar="JavaScript";
document.write(mychar+"<br>");
document.write(mystr+mychar+"的忠实粉丝!");
</script>
你试试这个
document.write(myname+"<br>"+"小可爱");
document.write(myname+"<br/>"+"小可爱");myname后面你都知道要用”+“号,后面就不用吗