我有一个表单,其中有一个文本字段配有提交按钮。单击提交按钮后,它会从第一个 php 页面重定向到第二个 php 页面。
索引.php
<form action="submit.php" method="get">
<input type="text" name="search" id="search" />
<input type="submit" value="submit" onclick="convert()" />
</form
<script type="text/javascript">
function convert()
{
alert("hi");
var str ;
str = document.getElementById("search").value;
document.writeln(str.toLowerCase());
}
</script>
提交表单时,我希望 url 变得像 Submit.php?search=text
我希望该文本为小写,尽管输入的文本为大写。
请指导我如何将此文本转换为小写,我正在使用上面的脚本将其转换为小写。但它不会将 URL 中的文本转换为小写。
请指导我这一点..
有一些错误,您缺少右尖括号</form>
并且您试图写入值而不是设置字段值,请尝试此...
<form action="submit.php" method="get">
<input type="text" name="search" id="search" />
<input type="submit" value="submit" onclick="convert();" />
</form>
<script type="text/javascript">
function convert() {
alert("hi");
var str;
var srch=document.getElementById("search");
str = srch.value;
srch.value=str.toLowerCase();
}
</script>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)