简体   繁体   English

实时生成图像的表格

[英]Form which generates image in real-time

I am looking to build a form which updates an image in real-time. 我正在寻找一种可以实时更新图像的表单。

Could someone help me out and tell me the best way to go about creating a form similar to this (languages, techniques, etc): http://www.demonplates.com/platebuilder.php 有人可以帮助我,告诉我创建类似于此表单的最佳方法(语言,技术等): http : //www.demonplates.com/platebuilder.php

Where as you enter details the image is updated accordingly. 输入详细信息时,图像将相应更新。 The form will send to google checkout with the data entered. 该表格会将输入的数据发送给Google Checkout。

Much appreciated. 非常感激。

You don't even have to use AJAX for this. 您甚至不必为此使用AJAX。 Assuming the script generating the image takes a GET parameter such as: generate_image.php?text=foo 假设生成图像的脚本采用GET参数,例如: generate_image.php?text=foo

You can just dynamically update the src attribute of the image every time the contents of the input box change. 每当输入框的内容更改时,您就可以动态更新图像的src属性。 Here's an example using jQuery. 这是使用jQuery的示例。

<input type="text" id="image_text" value="your text here" />
<br />
<img src="generate_image.php?text=your+text+here" alt="generated image" id="generated_image" />

And the JavaScript: 和JavaScript:

$('#image_text').change(function() {
    $('#generated_image').attr('src', $(this).val());
});

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

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