HOT*_*HOT 6 html android utf-8 android-webview cybersource
在Android WebView中加载以下代码时,Javascript没有被执行.
仅当值为✓的输入框包含在html中时才会出现问题.请参阅下面给出的代码中的文本输入字段,名称为"utf8".
此输入及其值由支付网关提供商返回,它是表单数据的一部分,需要将其提交到其域URL以完成付款.因此,值和html不能改变.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action=“” accept-charset=“UTF-8” method=“post”>
<input name=“utf8” type=“hidden” value=“✓” />
</form>
<script>
alert("hello world");
</script>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
问题见于:
完美地工作:
为什么要这样设置值?
\n\n为什么不在您的示例中将“类型”设置为复选框?
\n\n您只需在标签内包含“checked”即可将复选框设置为“checked”或“unchecked”。例如
\n\n<input name=\xe2\x80\x9cutf8\xe2\x80\x9d type=\xe2\x80\x9ccheckbox\xe2\x80\x9d value=\xe2\x80\x9cBuy_Milk\xe2\x80\x9d checked >\nRun Code Online (Sandbox Code Playgroud)\n\n您可以将 value 属性设置为相关的内容,例如“买牛奶”,然后您可以使用Javascript 中的.checked方法检查是否已勾选。
\n\ndocument.getElementById("utf8").checked = true;\n//Do something if true\n\ndocument.getElementById("utf8").checked = true;\n//Do something else if false\nRun Code Online (Sandbox Code Playgroud)\n\n据我所知,没有理由添加 unicode 引用作为值。
\n| 归档时间: |
|
| 查看次数: |
322 次 |
| 最近记录: |