数值微调器

前端之家收集整理的这篇文章主要介绍了数值微调器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、用DoJo实现数值微调器

NumberSpinner.html:

<!DOCTYPE html>
<html>
<head>
<Meta charset="UTF-8">
<title>数值微调器</title>
<link rel="stylesheet" type="text/css" href="dojoroot/dojo/resources/dojo.css">
<link rel="stylesheet" type="text/css" href="dojoroot/dijit/themes/tundra/tundra.css">
<script type="text/javascript" src="dojoroot/dojo/dojo.js" djConfig="parSEOnLoad:true"></script>
<style type="text/css">
 .form_body{
   width:20%;
   background-color: #CCCCCC;
   padding: 10px 10px 10px 10px;
 }
 label {
	 font-weight: bold;
	 color: #FF0000;
 }
</style>
<script type="text/javascript">
 dojo.require("dojo.parser");
 dojo.require("dijit.form.Form");
 dojo.require("dijit.form.Button");
 dojo.require("dijit.form.NumberSpinner");
</script>
<script type="dojo/method">
 dojo.mixin(this,{
     reset:function(){
      this.setValue(0);
    }
  });
</script>
</head>
<body class="tundra">
 <form dojoType="dijit.form.Form" class="form_body">
    <label for="number">数值微调器:</label>
    <input dojoType="dijit.form.NumberSpinner" constraints="{min:-100,max:100}" value=0/>
    <br/><br/>
    <label for="numberSpinner">数值微调器:</label>
    <input dojoType="dijit.form.NumberSpinner" constraints="{min:-100,max:100}" jsId="numberSp"
       value=0/>
    <br/><br/>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button dojoType="dijit.form.Button" onclick="numberSp.reset()">重置</button>
 </form>
</body>
</html>

2、运行项目是,Tomcat运行后出现:

七月 10,2013 12:33:19 上午 org.apache.catalina.core.AprLifecycleListener init
严重: An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed,while Tomcat requires version 1.1.24
七月 10,2013 12:33:21 上午 org.apache.catalina.core.AprLifecycleListener init
严重: An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed,2013 12:33:22 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:dojo' did not find a matching property.
七月 10,2013 12:33:22 上午 org.apache.catalina.core.AprLifecycleListener init
严重: An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed,2013 12:33:23 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
七月 10,2013 12:33:23 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
七月 10,2013 12:33:23 上午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 5444 ms
七月 10,2013 12:33:23 上午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
七月 10,2013 12:33:23 上午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.42
七月 10,2013 12:33:24 上午 org.apache.catalina.util.SessionIdGenerator createSecureRandom
信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [419] milliseconds.
七月 10,2013 12:33:24 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
七月 10,2013 12:33:24 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
七月 10,2013 12:33:24 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 1388 ms

这个是严重警告,对项目运行没有影响,关键之处是把JS和CSS引入的路径弄错了,导致结果显示不出来!

3、运行结果如图所示:

(1)未点击任何按钮


(2)点击上下按钮


(3)点击“重置”按钮

原文链接:https://www.f2er.com/dojo/291396.html

猜你在找的Dojo相关文章