如何在html中将python if语句添加到onchange事件 你好
我的html代码示例字符串:如何在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
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。