我设置了一个脚本,其中有人通过将漫画附加到URL来选择漫画以从列表中删除。但是,我不能为我的生活让它在文本框内接受输入笔划并仍然保持脚本功能。非常感谢任何解决方案。
脚本/表单如下所示:
function GoToURL(j) {
window.status=('Extracting')
var URLis;
URLis = document.URLframe.Dest.value
if (URLis == "" || URLis.length <= 0 || URLis > 20 )
{
j.value = "Try Again"
alert('Pick a comic that exists.');
window.status=('That comic does not exist.')
}
else
{
j.value = "Going" + URLis
var location=("aaw" + URLis +".html");
this.location.href = location;
window.status=('Connecting to ' + URLis + ' Please wait........');
}
}
</script>
<form name="URLframe">
<b>Comic #:</b>
<input type="TEXT" name="Dest" size="5" maxlength="3">
<input type="Button" name="Go to" value="Go" onClick="GoToURL(this)">
</form>
var URLis;
URLis = document.URLframe.Dest.value
if (URLis == "" || URLis.length <= 0 || URLis > 20 )
{
j.value = "Try Again"
alert('Pick a comic that exists.');
window.status=('That comic does not exist.')
}
else
{
j.value = "Going" + URLis
var location=("aaw" + URLis +".html");
this.location.href = location;
window.status=('Connecting to ' + URLis + ' Please wait........');
}
}
</script>
<form name="URLframe">
<b>Comic #:</b>
<input type="TEXT" name="Dest" size="5" maxlength="3">
<input type="Button" name="Go to" value="Go" onClick="GoToURL(this)">
</form>
答案 0 :(得分:0)
两个建议。
onclick="GoToURL(this)"
事件处理程序移至表单的onsubmit
处理程序。type="submit"
。