页面传值的javascript

<FORM action="htmlfile.jsp" enctype="multipart/form-data" method="post" name="form2">
<INPUT name=image style="left:0.98em; top: 16.126em; width:29.0em; height: 2.1294em; ime-mode: disabled;" type=file size=30 maxlength=3 value="" tabIndex=25 onfocus="select()">
<BUTTON ID=btnUpload style="left: 31.36em; top: 16.126em; width: 7em; height: 2.2em; " type=button onClick="btnUploadClick(this);" tabIndex=45 >上传</BUTTON>
</FORM>

 

 

提交到页面:

<form name="form1" action="insert_image.jsp" method="post">
<%
       String virtual = "/forum/images/";
           request.setCharacterEncoding("GBK");
           ForumUploadUtil upload = new ForumUploadUtil(pageContext.getServletContext());
           String path = upload.uploadFile(request);
          
          
           String strTemp[] = path.split("/");
     String fileName  = strTemp[strTemp.length-1];
    
     path = virtual + fileName; 
           System.out.println("论坛回贴上传图片path========"+path);          
          
           System.out.println("论坛回贴上传图片成功!");

           if(path.equals("") || path==null){
             out.println("上传文件失败,请检查文件类型及大小!");
           }
          
%>
 <INPUT TYPE="hidden" NAME="txtFileName" ID="txtFileName" VALUE="<%=path%>">
  
<script>
    alert("上传成功!");    
opener.window.document.all.txtFileName.value=document.all.txtFileName.value;
    
    alert(opener.window.document.all.linkFileName.value);
    
        window.close();    
</script>
   
</form>

你可能感兴趣的:(JavaScript,jsp)