我有这个这个语句遇到问题。
<INPUT id=event_submit_do_update_price onClick="javascript:return updateMaxPrice('1测试','测试1');" type=submit value=更新价格 name=event_submit_do_update_price>这与要达到的目的是更新"测试1"这个词的价格,页面抓图如下。
但是我发现一个问题,就是更新“测试1”的价格时候,把上面的语句更改为updateMaxPrice('1测试');" 提交后没有问题,但是如果更改成updateMaxPrice('测试1');" 就更新不了,我想问问这是怎么回事呢?我想修改成把updateMaxPrice里的值设置成和药更新的词一样的值。下面是updateMaxPrice函数
/**
* 用户设置好了价钱后,把数据准备好用于提交给服务器.
*/
function updateMaxPrice(word,wordalias) {
var re = /^\d{1,2}(\.\d{1,2})?$/;
var validMinPrice = document.getElementById("validMinPrice").value;
var validMaxPrice = document.getElementById("validMaxPrice").value;
var dailyMaxCost = document.getElementById("dailyMaxCost").value;
var balance = document.getElementById("balance").value;
var isPayedUser = document.getElementById("isPayedUser").value;
var newUpdateMaxPrice = document.getElementById("updatePrice").value;
if(newUpdateMaxPrice == "") {
window.alert("请设置好价钱后再进行更新");
return false;
} else {
if(isValidDecimal(newUpdateMaxPrice)) { if (isPayedUser == "true" && parseFloat(newUpdateMaxPrice) > balance) {
alert("出价不能超过账户余额[" + bto_scale(balance,2) + "]");
document.getElementById("reset").click();
return false;
}
if (isPayedUser == "true" && dailyMaxCost > 0 && parseFloat(newUpdateMaxPrice) > dailyMaxCost) {
alert("出价不能超过日消费限额[" + bto_scale(dailyMaxCost,2) + "]");
document.getElementById("reset").click();
return false;
}
document.getElementById("updatePrice").value = word + "=" + document.getElementById("updatePrice").value;
document.getElementById("wordalias_updatePrice").value = wordalias;
return true;
} else {
window.alert("请设置合法价钱后再进行更新");
document.getElementById("reset").click();
return false;
}
}
}
<INPUT id=event_submit_do_update_price onClick="javascript:return updateMaxPrice('1测试','测试1');" type=submit value=更新价格 name=event_submit_do_update_price>这与要达到的目的是更新"测试1"这个词的价格,页面抓图如下。
但是我发现一个问题,就是更新“测试1”的价格时候,把上面的语句更改为updateMaxPrice('1测试');" 提交后没有问题,但是如果更改成updateMaxPrice('测试1');" 就更新不了,我想问问这是怎么回事呢?我想修改成把updateMaxPrice里的值设置成和药更新的词一样的值。下面是updateMaxPrice函数
/**
* 用户设置好了价钱后,把数据准备好用于提交给服务器.
*/
function updateMaxPrice(word,wordalias) {
var re = /^\d{1,2}(\.\d{1,2})?$/;
var validMinPrice = document.getElementById("validMinPrice").value;
var validMaxPrice = document.getElementById("validMaxPrice").value;
var dailyMaxCost = document.getElementById("dailyMaxCost").value;
var balance = document.getElementById("balance").value;
var isPayedUser = document.getElementById("isPayedUser").value;
var newUpdateMaxPrice = document.getElementById("updatePrice").value;
if(newUpdateMaxPrice == "") {
window.alert("请设置好价钱后再进行更新");
return false;
} else {
if(isValidDecimal(newUpdateMaxPrice)) { if (isPayedUser == "true" && parseFloat(newUpdateMaxPrice) > balance) {
alert("出价不能超过账户余额[" + bto_scale(balance,2) + "]");
document.getElementById("reset").click();
return false;
}
if (isPayedUser == "true" && dailyMaxCost > 0 && parseFloat(newUpdateMaxPrice) > dailyMaxCost) {
alert("出价不能超过日消费限额[" + bto_scale(dailyMaxCost,2) + "]");
document.getElementById("reset").click();
return false;
}
document.getElementById("updatePrice").value = word + "=" + document.getElementById("updatePrice").value;
document.getElementById("wordalias_updatePrice").value = wordalias;
return true;
} else {
window.alert("请设置合法价钱后再进行更新");
document.getElementById("reset").click();
return false;
}
}
}
<% price = request("price")%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>淘宝直通车系统</title>
<style type="text/css">
<!--
@import url("http://tb.p4p.cn.yahoo.com/css/site.css");
@import url("http://tb.p4p.cn.yahoo.com/css/layout.css");
.STYLE1 {
color: #FF6600;
font-weight: bold;
}
.STYLE2 {font-weight: bold}
.STYLE5 {
color: #FF0033;
font-weight: bold;
}
.STYLE6 {font-size: 14px}
.FullWidth {text-align: center}
body {
margin-left: 0px;
margin-top: 0px;
}
-->
</style><script src="http://tb.p4p.cn.yahoo.com/javascript/generic.js"></script>
</head>
<body class="FullWidth"> <span style="width:20%;"><span class="jqmDialog">
<style type="text/css">
<!--
.STYLE3 {font-size: 16}
.STYLE4 {font-size: 14px;color:#FF0000}
.STYLE6 {font-size: 14px; font-weight: bold; }
.STYLE7 {
color: #FF6600;
font-weight: bold;
}
.STYLE8 {
color: #FF00ff;
font-weight: bold;
}.jBox{position: absolute;border: 1px solid #FF9500;visibility: hidden;background-color: white;text-align:center;}
.jBoxHandler{padding: 5px 0px;text-indent: 3px;font: bold 14px Arial;background-color: #FF9500;color: white;cursor: move;overflow: hidden;width: auto;height: 15px; }
.jBoxContent{background-color: #fff;color: #000;height: 50px;padding: 5px;overflow: auto;line-height:30px}
-->
</style>
<input name="hidden" type="hidden" class="jqmdX jqmClose" src="http://tb.p4p.cn.yahoo.com/images/close.gif" />
</span>
<input name="title" id="goodstitle" type="hidden" style="height: 20; width: 400" value="<%=session("goodstitle")%>" size="45" onpropertychange="limitTextByte(this,40)" oninput="limitTextByte(this,40)" maxlength="40"/>
<font color="red"></font>
<input name="description" type="hidden" id="description" value="<%=session("description")%>" size="45" />
</span>
<%
Set rs = conn.Execute("select top 1 * from (select top 1 * from product order by id) t order by id desc")
%>
<% namese = rs("namese")%> <table width="310" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" style="margin-top:4px">
<form id="bidwordform" name="bidwordform" method="POST" action="http://tb.p4p.cn.yahoo.com/treasuremanage/treasure_edit.htm">
<input type="hidden" id="action" name="action" value="bidwordmanage:bidWordManageAction"/>
<%shangpin=session("shangpin")%>
<INPUT id=goodsId type=hidden value= "<%=session("shangpin")%>" name=goodsId>
<input type="hidden" id="updatePrice" name="updatePrice" value=""/>
<input type="hidden" id="updateSortPrice" name="updateSortPrice" value=""/>
<input type="hidden" id="wordalias_updatePrice" name="wordalias_updatePrice" value=""/>
<input type="hidden" id="validMinPrice" name="validMinPrice" value="0.1"/>
<input type="hidden" id="validMaxPrice" name="validMaxPrice" value="100"/>
<input type="hidden" id="dailyMaxCost" name="dailyMaxCost" value="1000.00"/>
<input type="hidden" id="balance" name="balance" value="1806.18"/>
<input type="hidden" id="bidwordids" name="bidwordids" value=""/>
<input type="hidden" id="isPayedUser" name="isPayedUser" value=""/>
<input type="hidden" id="word" name="word" value=""/>
<input type="hidden" id="toPosition" name="toPosition" value=""/>
<input type="hidden" id="flag" name="flag" value=""/>
<input type="hidden" id="wordAlias" name="wordAlias">
<input type="hidden" id="errorMsg" name="errorMsg" value=""/>
<input type="hidden" id="msg" name="msg" value=""/>
<input type="hidden" id="isSortMatchFlag" name="isSortMatchFlag" value="false"/>
<tr bgcolor="#CCCCCC">
<td width="308" colspan="2" align="center" bgcolor="#EEEDDF"><!-- input type="button" name="event_submit_do_save_goods2" value="预 览" onclick = "viewSingleGood('http://tb.p4p.cn.yahoo.com/treasuremanage/treasure_view.htm?goods_id=ecae772767a9b900cdebb041ca5604e8')"/--> </td>
</tr>
<tr>
<td bgcolor="#eeeeee"><div id='loading2' style="min-height:10px;height:20px;text-align:center;border:2px solid #FF9500;display:none;line-height:20px;background-color:#FFFFFF">
</div>
<table width="100%" border="0" cellpadding="3" cellspacing="2" bgcolor="#FFFFFF">
<tr>
<td width="17%" align="left" bgcolor="#FFFFFF"><A href="#" onClick="toBidWordWhoIs('http://tb.p4p.cn.yahoo.com/treasuremanage/whois.htm?wordalias=%B2%E2%CA%D41')">
<%=rs("namese")%><br>
</A></td>
<td width="12%" bgcolor="#FFFFFF"><input name="text" type="text" value="<%=session("price")%>" size="8" style="text-align:right" onpropertychange="newMaxPrice(this);" /></td>
<td width="34%" bgcolor="#FFFFFF"> <input type="submit" id="event_submit_do_update_price" name="event_submit_do_update_price" onclick="updateMaxPrice('1测试,测试1');" value="更新价格" />
<input type="reset" id="reset" name="reset" value="重 置" style="display: none;" />
<input id="bidwords" type="checkbox" value="测试1" name="bidwords" checked style="display:none"/>
<input id="buybidwords" type="checkbox" value="测试1" name="buybidwords" checked style="display:none"/> </td>
</tr>
</table> </td>
</tr>
</form>
</table>
<center></center> <script type="text/javascript">
//检查
function checkInput(){ var title=document.getElementById("goodstitle").value;
title=jsTrim(title);
var description=document.getElementById("description").value;
description=jsTrim(description);
var td=title.concat(description);
var bidwords = document.getElementsByName("bidwords");
if (checkTitle(title,description)==false){
return false;
}
/*
if (bidwords!=null&& bidwords.length>0) {
var num=0;
for (var i = 0; i < bidwords.length; i++) {
if (bidwords[i].checked) {
//判断标题和描述是否包含此竞价词
var word=bidwords[i].value.toLowerCase(); var words=word.split(" ");
for (var ii=0;ii<words.length;ii++){
if (words[ii].length>=0 && td.toLowerCase().indexOf(words[ii])==-1){
alert("宝贝标题或者宝贝描述必须包含所设置的竞价词!");
return false;
}
}
}
}
}
*/
document.bidwordform.action.value="treasureManageAction";
return true;
}
/**
* 用户在价钱输入框中做了改动时激活这个事件.
*/
function newMaxPrice(maxpriceinput) {
document.getElementById("updatePrice").value = maxpriceinput.value;
}
/**
* 用户设置好了价钱后,把数据准备好用于提交给服务器.
*/
function updateMaxPrice(word) {
var re = /^\d{1,2}(\.\d{1,2})?$/;
var validMinPrice = document.getElementById("validMinPrice").value;
var validMaxPrice = document.getElementById("validMaxPrice").value;
var dailyMaxCost = document.getElementById("dailyMaxCost").value;
var balance = document.getElementById("balance").value;
var isPayedUser = document.getElementById("isPayedUser").value;
var newUpdateMaxPrice = document.getElementById("updatePrice").value;
if(newUpdateMaxPrice == "") {
window.alert("请设置好价钱后再进行更新");
return false;
} else {
if(isValidDecimal(newUpdateMaxPrice)) {
/*
if (!re.test(newUpdateMaxPrice) || parseFloat(newUpdateMaxPrice) > validMaxPrice || parseFloat(newUpdateMaxPrice) < validMinPrice) {
alert("请输入大于等于" + validMinPrice + "元,且小于" + validMaxPrice + "元金额的数字,小数点后两位");
document.getElementById("reset").click();
return false;
}
*/
if (isPayedUser == "true" && parseFloat(newUpdateMaxPrice) > balance) {
alert("出价不能超过账户余额[" + bto_scale(balance,2) + "]");
document.getElementById("reset").click();
return false;
}
if (isPayedUser == "true" && dailyMaxCost > 0 && parseFloat(newUpdateMaxPrice) > dailyMaxCost) {
alert("出价不能超过日消费限额[" + bto_scale(dailyMaxCost,2) + "]");
document.getElementById("reset").click();
return false;
}
document.getElementById("updatePrice").value = word + "=" + document.getElementById("updatePrice").value;
document.getElementById("wordalias_updatePrice").value = wordalias;
return true;
} else {
window.alert("请设置合法价钱后再进行更新");
document.getElementById("reset").click();
return false;
}
}
}
</script>
</body>
</html>