Advertisement
iRomain95

Untitled

Jul 13th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.49 KB | None | 0 0
  1. <script type="text/javascript">
  2. document.querySelector("html").classList.add('js');
  3.  
  4. var fileInput  = document.querySelector( ".input-file" ),  
  5.     button     = document.querySelector( ".input-file-trigger" ),
  6.     the_return = document.querySelector(".file-return");
  7.      
  8. button.addEventListener( "keydown", function( event ) {  
  9.     if ( event.keyCode == 13 || event.keyCode == 32 ) {  
  10.         fileInput.focus();  
  11.     }  
  12. });
  13. button.addEventListener( "click", function( event ) {
  14.    fileInput.focus();
  15.    return false;
  16. });  
  17. fileInput.addEventListener( "change", function( event ) {  
  18.     the_return.innerHTML = this.value;  
  19. });  </script>
  20. <style>.input-file-container {
  21.   position: relative;
  22.   width: 225px;
  23. }
  24. .js .input-file-trigger {
  25.   display: block;
  26.   padding: 14px 45px;
  27.   background: #2291e3;
  28.   color: #fff;
  29.   font-size: 1em;
  30.   transition: all .4s;
  31.   cursor: pointer;
  32. }
  33. .js .input-file {
  34.   position: absolute;
  35.   top: 0; left: 0;
  36.   width: 225px;
  37.   opacity: 0;
  38.   padding: 14px 0;
  39.   cursor: pointer;
  40. }
  41. .js .input-file:hover + .input-file-trigger,
  42. .js .input-file:focus + .input-file-trigger,
  43. .js .input-file-trigger:hover,
  44. .js .input-file-trigger:focus {
  45.   background: #3a5269;
  46.   color: #fff;
  47. }
  48.  
  49. .file-return {
  50.   margin: 0;
  51. }
  52. .file-return:not(:empty) {
  53.   margin: 1em 0;
  54. }
  55. .js .file-return {
  56.   font-style: italic;
  57.   font-size: .9em;
  58.   font-weight: bold;
  59. }
  60. .js .file-return:not(:empty):before {
  61.   content: "Selected file: ";
  62.   font-style: normal;
  63.   font-weight: normal;
  64. }
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71. /* Useless styles, just for demo styles */
  72.  
  73.  
  74. }
  75. form {
  76.   width: 225px;
  77.   margin: 0 auto;
  78.   text-align:center;
  79. }
  80. .txtcenter {
  81.   margin-top: 4em;
  82.   font-size: .9em;
  83.   text-align: center;
  84.   color: #aaa;
  85. }
  86. .copy {
  87.   margin-top: 2em;
  88. }
  89. .copy a {
  90.   text-decoration: none;
  91.   color: #1ABC9C;
  92. }</style>
  93. <form method="post" action="action.php" name="formular" enctype="multipart/form-data">
  94.        
  95.        
  96.        <div id="newad_forms">
  97.             <section id="form_part_ads" class="mtm">
  98.  
  99.     <article class="box-grey-dark">
  100.         <h2 class="title">
  101.             upload
  102.         </h2>
  103.         <div >
  104.             <input type="hidden" name="check_type_diff" />
  105.            
  106.             <div class="grid-2">
  107.                 <div><aside class="pictures-list">
  108.     <div>
  109.    <input class="input-file" id="my-file1" type="file" name="monfichier">
  110.             <label tabindex="0" for="my-file1" class="input-file-trigger">Choisir un fichier...</label>
  111.  
  112.     </div>
  113.    
  114.     </article>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement