javascript - 是否可以在 html 文本字段中显示图像?

标签 javascript jquery html css web

我们可以在 html 的文本字段中显示图像吗?

编辑

我想做的是有一个可编辑区域,并想在其中添加html对象(即按钮、图像等)

最佳答案

文本字段中的图像:

你可以用 CSS 做到这一点。

看这个例子:

http://jsfiddle.net/oscarj24/zy7YP/1/

CSS:

.icon {
    background:#FFFFFF url(http://icons.iconarchive.com/icons/gakuseisean/ivista-2/16/Start-Menu-Search-icon.png) no-repeat 4px 4px;
    padding:4px 4px 4px 22px;
    height:18px;
}​

HTML:

<input type="text" name="sample" class="icon">​

根据您的帖子编辑,这可能有所帮助。

内部有对象的可编辑区域:

http://jsfiddle.net/oscarj24/VSWNX/

关于javascript - 是否可以在 html 文本字段中显示图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10695544/

相关文章:

php - 用户可以在他们的个人资料描述中使用 html、css、javascript、php 等

javascript - 拖动后的谷歌地图标记位置

javascript - d3js 在多个图表之间切换

javascript - 如何在提交之前创建确认弹出警报?

jquery - HttpStatusCodeResult.StatusDescription 有多可靠?

html - CSS菜单中心定位

Javascript 将 30 或 20、22 天添加到原始日期?

javascript - 内容更改时 div 大小的动画变化

javascript - 这种 javascript 模块模式的优点是什么?

javascript - 如何判断jquery ajax返回值还是null