代码示例:(标识:dhtm_form_bg)
<html>
<head>
<script type="text/javascript">
function bgChange(bg)
{
document.getElementById('x').style.background="url(" + bg + ")"
}
</script>
</head>

<body>

<p>本例演示如何向输入框插入背景图像。</p>
<p>把鼠标移动到这两幅图像上,输入框会获得一幅背景图像。</p>

<table width="300" height="100">
<tr>
<td onmouseover="bgChange('/static/demo/images/eg_bg_03.gif')" 
background="/static/demo/images/eg_bg_03.gif">
</td>
<td onmouseover="bgChange('/static/demo/images/eg_bg_04.gif')" 
background="/static/demo/images/eg_bg_04.gif">
</td>
</tr>
</table>

<form>
<input id="x" type="text" value="把鼠标移动到图像上" size="20">
</form>

</body>
</html>
运行结果: