Home>

js upload multiple pictures example,To be more humane,Do not fix the number during initialization,The number of uploaded pictures can be determined by the user.That is, the number of upload picture frames and buttons is dynamically created.javascript upload multiple picture instances.

A small example of js multi-image upload:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>upload multiple pictures</title>
  <script type="text/javascript">
    function jm_wu (ob) {
      ob.style.display="none";
    }
    function jm_you (ob) {
      ob.style.display="";
    }
    function createform (textn, number) {
      data="";
      inter="" ";
      if (number<11&&number>-1) {
        for (i=1;i<= number;i ++) {
          if (i<10) spaces="";
          else spaces="";
          data=data + "<input name =" + textn + i + "type=text value =" "size =" 30 "maxlength =" 100 ">"
          + "&Input type =" button "value =" upload "+ i +" "onclick=javascript:uppic (" more "+ i +" "," more "+ i +" ") >>;
        }
        if (document.layers) {
          document.layers.cust.document.write (data);
          document.layers.cust.document.close ();
        }
        else {
          if (document.all) {
            cust.innerhtml=data;
          }
        }
      }
      else {
        window.alert ("Please do not exceed 10 pictures.");
      }
    }
</script>
</head>
<body>
  <form name="prodtable" action="">
  <input type="radio" name="more_pic" checked value="0" onclick="jm_wu (s1)">None
  <input type="radio" name="more_pic" value="1" onclick="jm_you (s1)">Yes<span>
    <input name="more" type="text" value="1" size="5" maxlength="2">
    <input type="button" value="Zhang Datu" onclick="createform (" more ", document.prodtable.more.value);">
    <span></span></span>
  </form>
</body>
</html>

This is just a small example of a guide,Students can change the button to browse picture button.

  • Previous Use of try and catch code blocks for exception handling in Java
  • Next Java garbage collection finalize ()