Home > Web Front-end > JS Tutorial > JavaScript multiple image upload case_javascript skills

JavaScript multiple image upload case_javascript skills

WBOY
Release: 2016-05-16 15:37:47
Original
1507 people have browsed it

JS multi-image upload small example:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>上传多图片</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='上传" + 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("请不要超过10张图片.");
      }
    }
</script>
</head>
<body>
  <form name="prodtable" action="">
  <input type="radio" name="more_pic" checked value="0" onclick="JM_wu(s1)">无
  <input type="radio" name="more_pic" value="1" onclick="JM_you(s1)">有 <span id="s1" style="display:none">
    <input name="more" type="text" value='1' size='5' maxlength='2'>
    <input type="button" value="张大图" onclick="createForm('more',document.prodtable.more.value);">
    <span id="cust" style="position: relative;"></span></span>
  </form>
</body>
</html>
Copy after login

This is just a small example of guidance. Students can replace the button with a browse picture button.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template