究竟在什么时候应该加上引号,什么时候不加呀?

dignity 2003-06-10 06:28:05
1)<%
response.write "<font size=5 color=red>" & "<center>"
response.write "两次输入密码不致,请重新输入"
response.write "<a href=add_member.htm>上一页</a>" & "</center>"
response.end
%>这样写正确。

<%
response.write "<font size="5" color=red>" "<center>"
response.write "两次输入密码不致,请重新输入"
response.write "<a href=add_member.htm>上一页</a>" & "</center>"
response.end
%>这样写错误。

为什么当size="5" 时(即加引号时)却提示出错?为什么当 color="red"时也出错?

究竟在什么时候应该加上引号,什么时候不加呀?我看有的程序中有引号的也正确呀。请大家详细说说。
2)<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>之中的<meta。。。。。。。。。。>是什么含义呀?如何执行?哪有相关参考资料。
...全文
813 15 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengxin107 2003-06-11
  • 打赏
  • 举报
回复
Response.Write 这后面是字符串
所以你要在Write 的后面保正你连接的字符串正确。
response.write "<font size="5" color="red">"&"<center>"

问题出现在size="这个引号,它把前面化分为一个字符串,5又不属于后面的字符串中的内容,所以你Write 后面是一个不完全的组合,就出错了。
wwwfwww 2003-06-11
  • 打赏
  • 举报
回复
字符串都要"",变量之间用 & 或者 +
zhuyngjie 2003-06-11
  • 打赏
  • 举报
回复
同意tripofdream(梦之旅)
比如你想打印一个引号可以这样
response.write """"
上面的四个引号第一个和第四个代表的是字符串的边界,第二个就相当于转义,第三个才是那个引号
dreamfly8848 2003-06-10
  • 打赏
  • 举报
回复
这个东东做多了就有体会了
tripofdream 2003-06-10
  • 打赏
  • 举报
回复
本质相当于转义字符,在字符串中用两个引号表示一个引号
dignity 2003-06-10
  • 打赏
  • 举报
回复
response.write "<font size="5" color="red">"&"<center>",不过象这种写法是不正确的。
改成两个response.write "<font size=""5"" color=""red"">"&"<center>",这样写到是成功了。是不是一个改成两个就只这一种情况(response.write 有关html标签中的引号时把一个改成两个,)下,其它的情况还有没有? 为什么这样写就对了呢? 能解释下为什么当response.write "<font size="5" color="red">"&"<center>"这种不对,而换成了2个就对了?
其原理是什么?
Struggling 2003-06-10
  • 打赏
  • 举报
回复
response.write "<font size='5' color='red'>"
zhuyngjie 2003-06-10
  • 打赏
  • 举报
回复
呵呵,就是在response.write 有关html标签中的引号时把一个改成两个
呵呵,不好意思上面没说清楚。现在明白了吗
dignity 2003-06-10
  • 打赏
  • 举报
回复
response.write "<font size=""5"" color=""red"">"&"<center>",asp中是不是所有的引号都是这样加的吗?能不能的详细些。 我看的有点晕。

zhuyngjie 2003-06-10
  • 打赏
  • 举报
回复
asp中加引号一般都
response.write "<font size=""5"" color=""red"">"&"<center>"
fason 2003-06-10
  • 打赏
  • 举报
回复
要养成良好的习惯,加引号,即使有时比较麻烦一点,对一般的属性加不加引号没大区别,一些特殊的如<input type="button" value="ff ff">value,就要加上,不然就会丢失空格后面的内容
dignity 2003-06-10
  • 打赏
  • 举报
回复
lqflsh说的再详细点如何???是否是asp文件中去掉引号,而在html中时加上引号,这样一定对吗/
lqflsh 2003-06-10
  • 打赏
  • 举报
回复
response.write "<font size=" 5" color=red>" "<center>"
---------------------------因为到横线上面,就认为这个字符串结束了。所以错。
如果不想错,又不知道什么时候加引号,调用asp的时候给引号去掉,html的时候加引号,其实不加也不会错的。
fason 2003-06-10
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/1870/1870290.xml?temp=.5267755
fason 2003-06-10
  • 打赏
  • 举报
回复
1." --> '
2.http://www.w3.org/TR/REC-html32.html#meta

28,408

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧