JavaScript Reference/Javascript Properties/accept

Материал из Web эксперт
Перейти к: навигация, поиск

"accept" Example

   <source lang="javascript">
   

<html> <head> <script language="JavaScript"> function function1() {

   document.all.myB.accept = "image/gif"; 

} </script> </head> <body onLoad="function1();"> <input type="text"

      name="textfield" 
      size="50" 
      accept="image/gif" 
      value="The content type of this field is "text/html"">

<input type="button"

      id="myB" 
      value="The content type for this button is "image/gif"">

</body> </html>


     </source>
   
  


"accept" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<input> | +----------------+--------------------------------------------------------------+

     </source>
   
  


"accept" Possible Values

   <source lang="javascript">

Possible Values text/html, image/png, image/gif, video/mpeg, audio/basic, text/tcl, text/javascript, text/vbscript.


     </source>
   
  


"accept" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Set the comma-separated MIME types.

Syntax:

document.getElementById("inputID").accept = value document.all.inputID.accept = value // IE only


     </source>