如何在文本字段值中添加 img
我想在文本字段的默认值内显示图片。这是我尝试过的,但它不起作用。
<input type="text" value="<img src="../images/left_arrow.gif" />Word" />
我尝试过逃避“但这不起作用
I wanna show a picture inside the default value of a text field. this is what I've tried but it doesn't work.
<input type="text" value="<img src="../images/left_arrow.gif" />Word" />
I've tried escaping the " but that doesn't work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要将图像作为元素的背景。
html
css
或者,如果您对实际箭头外观很灵活,则可以使用 unicode 字符来显示箭头 ie ⇐
了解更多 unicode 箭头:http://www.alanwood.net/unicode/arrows。 html
演示: http://jsfiddle.net/6GyVM/
you need to put the image as the background of the element..
html
css
Alternatively, if you are flexible about the actual arrow appearance, you could use a unicode char to display the arrow i.e. ⇐
for more unicode arrows: http://www.alanwood.net/unicode/arrows.html
demo: http://jsfiddle.net/6GyVM/
为什么要在文本字段中添加图片?如果只是装饰,使用CSS背景图片。
Why do you want a picture inside a text field? If it's just a decoration, use CSS background image.
这是针对 asp.net
http://www.bitrepository.com/how-to-add-a-stylish-icon-into-a-form-text-box.html
this is for asp.net
http://www.bitrepository.com/how-to-add-a-stylish-icon-into-a-form-text-box.html