我的带有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>'''
我该怎么做?
所有这些事情都需要在提交之前发生
答案 0 :(得分:0)
'''<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)