Use JS to give an upload file without refreshing the page scheme
<input id= "Upload" type= "file"/> <button id= "upload-btn" >upload</button>
document.getelementbyid (' upload-btn '). Onclick = function () { var oinput = document.getelementbyid (' upload '); var file = oInput.files[0]; //Selecting Files var formdata = new formdata (); //creating form Data Objects Formdata.append (' file ', file); //adding files to form objects fetch ({ //Transmission url: './', mothod: ' POST ', body:formdata }) .then ((d) =>{ console.log (' Result is ', D); Alert ("Upload complete! ") }) }
To achieve such an effect:
use Html+css to implement layout, border-width:5px, grid size is 50px*50px,hover, the border turns red and you need to consider semantics.
650) this.width=650; "Src=" https://uploadfiles.nowcoder.com/images/20170728/826546_1501229843213_ D08da487e4be8f2e89257e85d2ddd1ee "style=" border:0px;vertical-align:middle; "/>
table{ border-collapse:collapse; /* set a merge border model for a table */ margin:50px; text-align:center; /* Set Text Center */ } table tr{ border:none; } table.tab td{ width:50px; height:50px; border:5px inset blue; } table.tab td:hover{ border :5px solid red; cursor: pointer; }
<table class= "tab" > <tr> <td> 1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> <tr> <td>7</td> <td> 8</td> <td>9</td> </tr> </table>
No refresh upload file