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

JavaScript multiple image upload case_javascript skills

May 16, 2016 pm 03:37 PM
javascript upload picture

JS multi-image upload small example:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

<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.

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement an online speech recognition system using WebSocket and JavaScript How to implement an online speech recognition system using WebSocket and JavaScript Dec 17, 2023 pm 02:54 PM

How to implement an online speech recognition system using WebSocket and JavaScript

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems WebSocket and JavaScript: key technologies for implementing real-time monitoring systems Dec 17, 2023 pm 05:30 PM

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems

How to implement an online reservation system using WebSocket and JavaScript How to implement an online reservation system using WebSocket and JavaScript Dec 17, 2023 am 09:39 AM

How to implement an online reservation system using WebSocket and JavaScript

How to use JavaScript and WebSocket to implement a real-time online ordering system How to use JavaScript and WebSocket to implement a real-time online ordering system Dec 17, 2023 pm 12:09 PM

How to use JavaScript and WebSocket to implement a real-time online ordering system

JavaScript and WebSocket: Building an efficient real-time weather forecasting system JavaScript and WebSocket: Building an efficient real-time weather forecasting system Dec 17, 2023 pm 05:13 PM

JavaScript and WebSocket: Building an efficient real-time weather forecasting system

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

Simple JavaScript Tutorial: How to Get HTTP Status Code

How to get HTTP status code in JavaScript the easy way How to get HTTP status code in JavaScript the easy way Jan 05, 2024 pm 01:37 PM

How to get HTTP status code in JavaScript the easy way

How to use insertBefore in javascript How to use insertBefore in javascript Nov 24, 2023 am 11:56 AM

How to use insertBefore in javascript

See all articles