0
如何从文本框中删除选项卡空间值。我的功能代码::从Javascript中的文本框中删除选项卡空间
function validTitle() {
if (window.document.all.dDocTitle.value == "") {
alert("Please enter the Title");
window.document.all.dDocTitle.focus();
return false;
}
return true;
}
我想通过添加1更多的条件在文本框中与window.document.all.dDocTitle.value
捕获值中去除标签空间
谢谢。我做到了,但是在修剪的情况下仍然没有提醒。为了测试,我复制了一个标签空间标题从记事本粘贴到标题字段,但它没有给出警报。总之,我想限制用户从任何来源输入标签空间标题,因为当这个元数据在第三个应用程序中流动时它会产生问题 –
我这样做了,它也不能工作......... function validTitle( ){ \t if(window.document.all.dDocTitle.value ==“”){ \t alert(“请输入标题”); \t window.document.all.dDocTitle.focus(); \t return false; \t} \t window.document.all.dDocTitle.value = value.replace(/(^ [\ t] + | [\ t] + $)/ g,''); \t返回true; \t} –
对不起!我误解了你的需求。我刚编辑我的解决方案。我认为这是你需要的。 –