| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 896 人关注过本帖
标题:ASP運算?請問
只看楼主 加入收藏
unix
Rank: 1
等 级:新手上路
帖 子:134
专家分:0
注 册:2005-12-28
收藏
 问题点数:0 回复次数:4 
ASP運算?請問

<input name="set" type="text" id="set" size="12"><input name="danjia" type="text" id="danjia" size="12"><input name="jine" type="text" id="jine" size="12" readonly="true">

如果我要將set * danjia =jine

這個<input name="jine" type="text" id="jine" size="12" readonly="true"> 要怎麼寫?

搜索更多相关主题的帖子: ASP 
2006-03-10 10:35
unix
Rank: 1
等 级:新手上路
帖 子:134
专家分:0
注 册:2005-12-28
收藏
得分:0 
<input name="jine" type="text" id="jine" size="12" readonly="true" onclick=javascript:this.value=form1.set.value*form1.danjia.value>

改成這樣後我點擊一下才能計算,能不能自動啊?
2006-03-10 10:48
unix
Rank: 1
等 级:新手上路
帖 子:134
专家分:0
注 册:2005-12-28
收藏
得分:0 
<input name="set" type="text" id="set" size="12" onkeyup=javascript:form1.jine.value=form1.set.value*form1.danjia.value><input name="danjia" type="text" id="danjia" size="12" onkeyup=javascript:form1.jine.value=form1.set.value*form1.danjia.value><input name="jine" type="text" id="jine" size="12" readonly="true">

改成這樣就可以了。

可是我的是動態的啊?要昨啊??


<script language=javascript type=text/javascript>
<!--
var RES_BT_DELETE = "刪除";
var isIE = (navigator.userAgent.indexOf("MSIE") != -1);
var fileIndex = 1;
function addFile() {
var spanId = "filespan";
var fileId = "upload" + (fileIndex++);
addInputFile(spanId, fileId);
}
function addInputFile(spanId, fileId) {
var span = document.getElementById(spanId);
if (span != null) {
var divObj = document.createElement("div"), lianluoObj, indexObj, buObj, setObj, danjiaObj,jineObj, delObj;
divObj.id = fileId;
if (isIE) {
lianluoObj = document.createElement("<input type=hidden>");
indexObj = document.createElement("<input type=text>");
buObj = document.createElement("<input type=text>");
setObj = document.createElement("<input type=text>");
danjiaObj = document.createElement("<input type=text>");
jineObj = document.createElement("<input type=text readonly=true>");
delObj = document.createElement("<input type=button onclick=delInputFile('" + spanId + "','" + fileId + "')>");
} else {
lianluoObj = document.createElement("input");
lianluoObj.type = "hidden";
indexObj = document.createElement("input");
indexObj.type = "text";
buObj = document.createElement("input");
buObj.type = "text";
setObj = document.createElement("input");
setObj.type = "text";
danjiaObj = document.createElement("input");
danjiaObj.type = "text";
jineObj = document.createElement("input");
jineObj.type = "text";
delObj = document.createElement("input");
delObj.type = "button";
delObj.setAttribute("onclick", "delInputFile('" + spanId + "','" + fileId + "')", 0);
}
lianluoObj.id = "lianluo";lianluoObj.value = '<%=lianluo%>';lianluoObj.name = "lianluo";
indexObj.name = "indexs";indexObj.disabled = true;indexObj.id = "indexs";indexObj.size = "6";indexObj.value = fileIndex;
buObj.name = "bu";buObj.id = "bu";buObj.size = "49";
setObj.name = "set";setObj.id = "set";setObj.size = "12";
danjiaObj.name = "danjia";danjiaObj.id = "danjia";danjiaObj.size = "12";
jineObj.name = "jine";jineObj.id = "jine";jineObj.size = "12";
delObj.value = RES_BT_DELETE;
divObj.appendChild(lianluoObj);
divObj.appendChild(indexObj);
divObj.appendChild(buObj);
divObj.appendChild(setObj);
divObj.appendChild(danjiaObj);
divObj.appendChild(jineObj);
divObj.appendChild(delObj);
span.appendChild(divObj);
}
}
function delInputFile(spanId, fileId) {
var span = document.getElementById(spanId);
var divObj = document.getElementById(fileId);
if (span != null && divObj != null) {
span.removeChild(divObj);
}
}
//-->
</script>
2006-03-10 10:54
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
<!--
function SumPrice(){
document.all("jine").value = document.all("set").value * document.all("danjia").value;
}
//-->
</script>
</head>

<body>
<input name="set" type="text" id="set" size="12" onkeydown="SumPrice();" onkeyup="SumPrice();">
<input name="danjia" type="text" id="danjia" size="12" onkeydown="SumPrice();" onkeyup="SumPrice();">
<input name="jine" type="text" id="jine" size="12" readonly="true" onkeydown="SumPrice();" onkeyup="SumPrice();">
</body>
</html>

[此贴子已经被作者于2006-3-10 11:36:59编辑过]


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2006-03-10 11:36
unix
Rank: 1
等 级:新手上路
帖 子:134
专家分:0
注 册:2005-12-28
收藏
得分:0 

咽咽。謝謝

2006-03-13 16:08
快速回复:ASP運算?請問
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038441 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved