Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在html中将python if语句添加到onchange事件 你好_Python_Html_Bottle - Fatal编程技术网

如何在html中将python if语句添加到onchange事件 你好

如何在html中将python if语句添加到onchange事件 你好,python,html,bottle,Python,Html,Bottle,我的html代码示例字符串: x = '''<input type="text" name="firstname"> <input type="text" name="firstname1"> <input type="text" name="firstname2"> <input type="t

我的html代码示例字符串:

x =  '''<input type="text" name="firstname">
<input type="text" name="firstname1">
        <input type="text" name="firstname2">
      <input type="text" name="txt"  onchange="myFunction()">   
<input type="submit" value="Submit">

<script>
function myFunction() {
        ''' --->python code--->if request.forms.get('txt'):
return x= "ok"
'''

}
</script>'''
x=''
函数myFunction(){
''-->python代码-->if request.forms.get('txt'):
return x=“确定”
'''
}
'''
我怎么能做那样的事

所有这些都需要在提交之前完成
'''<input type="text" name="firstname">
<input type="text" name="firstname1">
<input type="text" name="firstname2">
<input type="text" name="txt"  onchange="myFunction()">   
<input type="submit" value="Submit">

<script>
function myFunction() {
 {}
}
</script>'''.format(THE PYTHON CODE THAT EVALUATE TO TEXT)
函数myFunction(){ {} } ''。格式(计算为文本的PYTHON代码)
不能使用Python进行此操作。使用Javascript。