空のAsp.net FileUploadコントロール


[size=medium]

<script type="text/javascript">
	        function chkFormat(fuPhoto)
	        {
	            //          
	            var docName = fuPhoto.value;
	            //             (toLocaleLowerCase()  )       
	            var docSurfix = docName.toLocaleLowerCase().substr(docName.lastIndexOf("."));
	            //         
	            if(docSurfix != ".jpg" && docSurfix != ".png")
				{
					alert("   JPG     ");
					//       FileUpload  
                    var html=document.getElementById('uploadSpan').innerHTML;
                    document.getElementById('uploadSpan').innerHTML=html;
					return;
				}				
	        }
      </script>



<span id="uploadSpan"><asp:FileUpload ID="fuUserPhoto" runat="server" onchange="chkFormat(this)" /></span>





<div id="test"><span style="color:red">test1</span> test2</div> 
 JS   :
 innerHTML: 
                      ,  Html  。


      test.innerHTML    “<span style="color:red">test1</span> test2 ”
 innerText: 

                 ,     Html   

      text.innerTest     “test1test2”,   span     


 outerHTML:

        innerHTML      ,          。

      text.outerHTML     <div id="test"><span style="color:red">test1</span> test2</div>


[/size]