|
本帖最后由 superlong 于 2013-3-28 16:49 编辑
<div class="title"><h3>同步带节线长计算软件</h3></div>
<div class="Content"><style type="text/css">
<!--
.STYLE2 {
font-size: 18px;
font-family: "宋体";
color: #0000FF;
}
.STYLE4 {font-size: 16px}
.STYLE5 {color: #000000}
.STYLE6 {font-size: 16px; color: #000000; }
.STYLE7 {
color: #FF0000;
font-weight: bold;
}
--></style><script type="text/javascript">
function blnCheckRequirement(o, strMsg)
{
o.value = strSpaceBothEndsCut(o.value);
if (blnOnlySpace(o.value)) {
vodErrMsgFocus(o,strMsg);
return false;
}
return true;
}
function vodErrMsgFocus(o,strMsg)
{
if (strMsg != ''){
alert(strMsg);
if (typeof(o) == "undefined"){
return false;
}
if (typeof(o) == 'object'){
vodFocusTo(o);
}
}
}
function vodFocusTo(o)
{
o.focus();
if (o.tagName == "INPUT"
&& (o.type.toUpperCase() == "BUTTON" || o.type.toUpperCase() == "SUBMIT")) {
return;
}
if (typeof(o.select) != 'undefined') {
o.select();
}
}
function strSpaceBothEndsCut(v)
{
return (v.replace(/^[\s ]+|[\s ]+$/g, ''));
}
function blnOnlySpace(s)
{
var re, arr;
re = /[^ \t\n\r]/;
arr = re.exec(s);
if (arr != null){
return false;
}else{
return true;
}
}
function calcLp()
{
var Pb, Z1, Z2, a, Lp;
var objForm = document.CalcForm;
if (!blnCheckRequirement(objForm.selPb, "请输入“齿型”。")) {
return false;
}
if (!blnCheckRequirement(objForm.txtZ1, "请输入“主动轮齿数”。")) {
return false;
}
if (isNaN(objForm.txtZ1.value)) {
vodErrMsgFocus(objForm.txtZ1, "请在“主动轮齿数”中,输入数字值。");
return false;
}
if (!blnCheckRequirement(objForm.txtZ2, "请输入“被动轮齿数”。")) {
return false;
}
if (isNaN(objForm.txtZ2.value)) {
vodErrMsgFocus(objForm.txtZ2, "请在“被动轮齿数”中,输入数字值。");
return false;
}
if (!blnCheckRequirement(objForm.txtA, "请输入“设计中心距”。")) {
return false;
}
if (isNaN(objForm.txtA.value)) {
vodErrMsgFocus(objForm.txtA, "请在“设计中心距”中,输入数字值。");
return false;
}
Pb = parseFloat(objForm.selPb.value);
Z1 = parseFloat(objForm.txtZ1.value);
Z2 = parseFloat(objForm.txtZ2.value);
a = parseFloat(objForm.txtA.value);
Lp = 2 * a + (Z1 + Z2) * Pb / 2 + Math.pow((Z2 - Z1) * Pb / 3.14, 2) / (4 * a);
objForm.txtLp.value = Math.round(Lp * 100) / 100;
}
function calcAR()
{
var Pb, Z1, Z2, Zb, M, a;
var objForm = document.CalcForm;
if (!blnCheckRequirement(objForm.selPb, "请输入“齿型”。")) {
return false;
}
if (!blnCheckRequirement(objForm.txtZ1, "请输入“主动轮齿数”。")) {
return false;
}
if (isNaN(objForm.txtZ1.value)) {
vodErrMsgFocus(objForm.txtZ1, "请在“主动轮齿数”中,输入数字值。");
return false;
}
if (!blnCheckRequirement(objForm.txtZ2, "请输入“被动轮齿数”。")) {
return false;
}
if (isNaN(objForm.txtZ2.value)) {
vodErrMsgFocus(objForm.txtZ2, "请在“被动轮齿数”中,输入数字值。");
return false;
}
if (!blnCheckRequirement(objForm.txtZb, "请输入“齿数”。")) {
return false;
}
if (isNaN(objForm.txtZb.value)) {
vodErrMsgFocus(objForm.txtZb, "请在“齿数”中,输入数字值。");
return false;
}
Pb = parseFloat(objForm.selPb.value);
Z1 = parseFloat(objForm.txtZ1.value);
Z2 = parseFloat(objForm.txtZ2.value);
Zb = parseFloat(objForm.txtZb.value);
M = Pb * (2 * Zb - Z1 - Z2) / 8;
a = M + Math.sqrt(Math.pow(M, 2) - Math.pow(Pb * (Z2 - Z1) / 3.14, 2) / 8);
objForm.txtAR.value = Math.round(a * 1000) / 1000;
}
</script>
<p class="STYLE2">同步带节线长计算</p>
<form action="" method="post" name="CalcForm">
<label><span class="STYLE4">输入齿型</span> <select name="selPb">
<option value="" selected="selected"></option>
<option value="2.032">MXL</option>
<option value="5.08">XL</option>
<option value="9.525">L</option>
<option value="12.7">H</option>
<option value="22.225">XH</option>
<option value="31.75">XXH</option>
<option value="2">S2M/P2M</option>
<option value="3">3M/S3M/P3M</option>
<option value="4.5">S4.5M</option>
<option value="5">5M/S5M/P5M</option>
<option value="8">8M/S8M/P8M</option>
<option value="14">14M/S14M/P14M</option>
<option value="20">20M</option>
<option value="2.5">T2.5</option>
<option value="5">T5/AT5</option>
<option value="10">T10/AT10</option>
<option value="20">T20/AT20</option>
</select> </label><label><span class="STYLE4">输入主动轮齿数</span> <input maxlength="3" size="10" name="txtZ1" type="text" /> </label><label><span class="STYLE4">输入被动轮齿数</span> <input maxlength="3" size="10" name="txtZ2" type="text" /> </label><label><span class="STYLE4"><br />
<br />
输入设计中心距</span> <input size="15" name="txtA" type="text" /> <span class="STYLE4">mm</span> </label><input type="button" value="计算" />
<p class="STYLE2"><span class="STYLE6">节线长计算结果</span><span class="STYLE5">:</span> <input readonly="readonly" size="15" name="txtLp" type="text" /> <span class="STYLE6">mm </span></p>
<hr />
<p class="STYLE2"><span class="STYLE6">根据样本现成模具型号,选择接近的同步带型号,其齿数为</span> <input size="10" name="txtZb" type="text" /> <input type="button" value="计算" /></p>
<p class="STYLE4">使用节线长接近同步带型号,中心距则为: <input readonly="readonly" size="15" name="txtAR" type="text" /> mm</p>
<hr />
<p style="text-align: center"><input type="reset" value="清除内容" /></p>
</form>
新建一个文本文件把这些代码复制粘贴另存为网页格式放在桌面用起来就很方便了
|
评分
-
查看全部评分
欢迎继续阅读楼主其他信息
|