【发布时间】:2012-04-18 02:28:21
【问题描述】:
我有这段 html 代码:
<form name="postcode" method="post" onsubmit="return OnSubmitForm();">
<input class="postcode" maxlength="1" size="1" name="c" onKeyup="autotab(this, document.postcode.o)" />
<input class="postcode" maxlength="1" size="1" name="o" onKeyup="autotab(this, document.postcode.d)" />
<input class="postcode" maxlength="1" size="1" name="d" onKeyup="autotab(this, document.postcode.e)" />
<input class="postcode" maxlength="1" size="1" name="e" /> <br />
</form>
使用这个javascript:
<script>
/*
Auto tabbing script- By JavaScriptKit.com
http://www.javascriptkit.com
This credit MUST stay intact for use
*/
function autotab(original,destination){
if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
destination.focus()
}
</script><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
<script src="js/scripts.js" type="text/javascript"></script>
<script type="text/javascript">
function OnSubmitForm()
{
if(document.postcode.operation[0].checked == true)
{
document.postcode.action ="plans.php";
}
else
if(document.postcode.operation[1].checked == true)
{
document.postcode.action ="plans_gas.php";
}
else
if(document.postcode.operation[2].checked == true)
{
document.postcode.action ="plans_duel.php";
}
return true;
}
</script>
只要您在其中一个文本框中输入一个字符,它就会自动跳到下一个文本框。
这在 pc 或 mac 以及 safari 以及所有其他浏览器上都可以正常工作。但是在 iPad 或 iPhone 上(使用 safari)查看网页时,自动选项卡功能不起作用。
关于如何使自动标签在这些移动设备上工作的任何想法?
【问题讨论】:
-
您已连续两次发布此问题。
标签: javascript iphone html ios ipad