打印滑块输出

时间:2016-12-17 06:46:27

标签: javascript

我想要已经编码的滑块,然后让它打印输出。例如,如果将滑块滑动到45,它将打印45.这就是我所拥有的 -

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>

 <div data-role="page">
  <div data-role="header">
    <h1>Choose a Slider Output</h1>
  </div>

  <div data-role="main" class="ui-content">
    <form method="post" action="demoform.asp">
      <label for="percentage">Percentage:</label>
      <input type="range" name="percentage" id="percentage" value="50" min="1" max="100">
      <input type="submit" data-inline="true" value="Submit">
    </form>
  </div>
</div>

<script>
var sliderValue;
$(function () {
   $("#percentage").on("slidestop", function () {
     sliderValue =  $(this).val();
   })
   $("#percentage").on("change", function () {
     sliderValue =  $(this).val();
   })
});

<document.getElementById("print2").innerHTML = sliderValue>

</script>

</body>
</html>

虽然它没有打印任何东西。请告诉我什么是错的,请帮助我。谢谢!

0 个答案:

没有答案