输入标签内的链接
如何在输入框(文本框)内显示 a href
和 img src
。例如:我想将其显示在文本框内( ),
<a href="http://www.mysite.com/link" target="_blank"><img src="http://www.mysite.com/img.jpg" border="0" alt="mysite.com"></a>
提前致谢。
How to display a a href
and a img src
inside a input box (text box). ex: i want to display this inside a text box ( <input id=link
)
<a href="http://www.mysite.com/link" target="_blank"><img src="http://www.mysite.com/img.jpg" border="0" alt="mysite.com"></a>
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据评论,我猜测您需要一个将该 HTML 代码作为默认文本的输入字段。您必须使用引号和小于/大于符号的字符参考代码。
(顺便说一句,您提到“就像在 Photobucket 中一样”——您只需查看该网站的 HTML 即可了解他们是如何做到这一点的。)
Based on the comments, I would guess that you want an input field that has that HTML code as the default text. You must use character reference codes for quotes and less/greater than signs.
(By the way, you mentioned "like in Photobucket" -- you can just look at the site's HTML to see how they do it.)
你有两个选择。
1:
2:
HTML
CSS
您需要根据输入大小、图像大小和一般位置来调整位置和值,但这应该可以满足您的要求。
You have two options.
1:
2:
HTML
CSS
You'll need to play with the position and values depending on your input size, image size and general placement, but that should do what you want.
正如评论所提到的,您不能从字面上将链接放入
input
文本框中(尽管您可以使用 JavaScript 模拟一个链接)。对于背景图像,请使用 CSS
background-image
。As comments mention, you can't literally put a link in an
input
text box (although you could simulate one with JavaScript).For the background image, use CSS
background-image
.