繁体   English   中英

当用户在文本框中输入文字时,如何在图像上显示文字?

[英]How to show text over the image when user type in text box?

这里是示例: http : //www.potterybarn.com/products/saddle-stitch-leather-luggage-tag/? catalogId=69&cm_src=AutoRel

当用户在“查看您的个性化设置在此商品上的外观”中输入一些文字时。 指定文本:',然后按预览,该文本将以某种特定的字体样式显示在图像上。 那么问题是如何做到的? 这是JavaScript吗? 如果是,那我应该从哪里得到呢?

然后从这个想法

<html>
<head>
<script>
function preview()
{
document.getElementById("txt").innerHTML=document.getElementById("person").value;
}</script></head>
<body>
<div style="position:relative;">
<img src="whatever"><span id="txt" style="font:20px Tahoma;position:absolute;top:0px;left:0px;"></span>
</div>
<label for="person">See how your personalization would look on this item. Specify text:</label><input type="text" id="person" >
<button onclick="preview()">Preview</button></body></html>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM