[英]IMG tag does not display after INPUT tag
Given the html fragment 给定html片段
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Test JQuery AppendTo</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
</head>
<body>
<div id="Test1">
<p>Just some text</p>
</div>
<form name="FORMPOST" method="post" action="showform.aspx" id="FORMPOST" >
<label for="Test2">Test Label</label>
<input id="Test2" type="checkbox" />
<img src=\"add2.jpg\">
</form>
</body>
</html>
and given that the add2.jpg image is in the same directory as the html code, why does the image not display? 并假设add2.jpg图片与html代码位于同一目录中,为什么该图片不显示? Note that if I move the image tag node to be inside the div node, it will display :(
请注意,如果我将图像标签节点移动到div节点内,它将显示:(
Note the display does not appear regardless of whether I add the img tag at design time as above, or append it using the jQuery.appendTo function when the form loads. 请注意,无论我是如上所述在设计时添加img标签,还是在加载表单时使用jQuery.appendTo函数将其附加,该显示都不会出现。
For one, you shouldn't have back slashes there for quotes. 首先,您不应该在其中使用反斜杠来引用报价。 Can you give us a link to the page itself?
您能给我们链接到页面本身吗? Because that will work.
因为那行得通。
Were the backslashes in <img src=\\"add2.jpg\\">
a typo? 是
<img src=\\"add2.jpg\\">
错字中的反斜杠吗? <img src=\\"add2.jpg\\">
should be <img src="add2.jpg" />
. <img src=\\"add2.jpg\\">
应该是<img src="add2.jpg" />
。
You need the forward slash to end the img
tag because you are using XHTML. 您需要使用正斜杠来结束
img
标记,因为您正在使用XHTML。
Your image tag doesn't look correctly formed to me 您的图片标签对我来说看起来不正确
<img src="add2.jpg" />
Does this work for you like the above? 这样对您有用吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.