关于jsp中的聚焦方法 [英] regarding focus method in jsp
问题描述
朋友们,
我有一个名为file_upload.jsp的jsp文件和一个名为file_upload.js的Java脚本文件.在jsp页面中,我有一个字段作为文件上载,而id为file_upload.为此,如果我没有输入文件上载字段然后去它正在显示警报消息,请选择要上载的文件,但它不专注于文本字段.我的要求是无论我忘记输入值(错误来了),都必须专注于该字段.我的代码如下.
Hi friends,
i have one jsp file called as file_upload.jsp and one java script file called file_upload.js.In jsp page i have a field as file upload and the id is file_upload.For this if i did not enter the file upload field and going then it is displaying the alert message as please select a file to upload but it is not focusing on the textfield.My requirement is it has to focus on the field wherever i forget to enter the values(the error comes).My code is as follows.
if (file_upload == "") {
alert("Please select a file to Upload !!");
document.getElementById('file_upload').focus();
return false; }
我的代码中有任何错误或必须添加的其他内容.这对我来说非常紧急,任何帮助将不胜感激.
Any thing wrong in my code or any thing extra i have to add.This is very urgent to me any ones help will be greately appreciated.
推荐答案
我不知道''出于安全原因,您认为可以使文件上载控件成为焦点,就像无法从中获取文本一样.
I don''t think it''s possible to make the file upload control the focus, just as it''s not possible to get the text from it, for security reasons.
这篇关于关于jsp中的聚焦方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!