0
<form name="myform" action="app.py">
<div class="box">

<input type="image" id="image" src="http://mychickencoopplans.files.wordpress.com/2010/12/happy-chicken.jpg" >

</div>
</form>

我正在尝试创建一张图片,点击后将其发送到服务器(app.py)?我将如何使用 HTML/javascript 完成此操作?谢谢。

4

2 回答 2

1

尝试:

    <form name="myform" action="app.py">
        <input type="hidden" value="" id="hidSrc">
        <div class="box">
            <input type="image" id="image" onclick="document.getElementById('hidSrc').value = this.src;document.myform.submit();" src="http://mychickencoopplans.files.wordpress.com/2010/12/happy-chicken.jpg" >
        </div>
    </form>
于 2012-12-03T05:03:36.463 回答
1

你可以试试这个

<form name="myform" action="app.py">
    <input type="hidden" value="" id="hidimgSrc">
    <div class="box">
        <input type="image" id="image" onclick="document.getElementById('hidimgSrc').value = this.src;document.getElementById('myform').submit();" src="http://mychickencoopplans.files.wordpress.com/2010/12/happy-chicken.jpg" >
    </div>
</form>
于 2012-12-03T05:06:09.073 回答