替换数组中值的逗号 [英] Replace commas in values in an array
问题描述
虽然这是客户端问题,但我也发布到asp.general
以防万一有这样的服务器端(我会这样做)b
(b)这是我的表格:
action ="<%= request.servervariables(" Script_name")
%>"
<%for i - 0 to 4%>
标题:< input type =" text"名称= QUOT;报头QUOT; id =" header<%= i%>"
onblur =" function(this)">< br>
说明:< input type =" text"名称= QUOT;描述" id =" description<%= i
%>" onblur =" function(this)">
<%next%>
< input type =" submit" value =" Submit">
< / form>
当数据返回时,它类似于:
标题:袜子,鞋子,披萨,猫,狗
描述:适合脚,穿袜子,只有奶酪,有很多
当我的描述或标题都有逗号时,会出现问题,或者说很多时候会发出吠叫声。
我需要一个
的小javascript,它将用分号客户端
替换逗号,然后才能到达服务器的
,最好是在他们离开时这个领域。
任何帮助都会非常感激。
-
Adrienne Boswell在工作
管理员nextBlock.com
http:// atlas .nextblock.com / files /
请回复群组,以便其他人可以分享
Although this is a client side issue, I am also posting to asp.general
in case there is someway to do this only server side (which I would
prefer).
Here''s my form:
<form method="post" action="<%=request.servervariables("Script_name")
%>"
<% for i - 0 to 4%>
Header: <input type="text" name="header" id="header<%=i%>"
onblur="function(this)"><br>
Description: <input type="text" name="description" id="description<%=i
%>" onblur="function(this)">
<% next%>
<input type="submit" value="Submit">
</form>
When the data gets returned it''s something like:
header: "socks, shoes, pizza, cats, dogs"
description: "good for feet, wear with socks, cheese only, have lots
of hair, bark a lot"
Problem comes when the description or header have a comma. I need a
little javascript that will replace the comma with a semicolon client
side before it gets to
the server, preferably as they leave the field.
Any help with this would be much appreciated.
--
Adrienne Boswell at work
Administrator nextBlock.com
http://atlas.nextblock.com/files/
Please respond to the group so others can share
推荐答案
Adrienne Boswell于2007年4月6日在
microsoft.public.inetserver.asp.general写道:
Adrienne Boswell wrote on 06 apr 2007 in
microsoft.public.inetserver.asp.general:
虽然这是一个客户端边问题,我也发布到asp.general
以防万一有这样的服务器端(我会优先选择b $ b)。
Although this is a client side issue, I am also posting to asp.general
in case there is someway to do this only server side (which I would
prefer).
[...]
[...]
当描述或标题有逗号时出现问题。我需要一个
的小javascript,它会在到达服务器之前用分号客户端
替换逗号,最好是在他们离开现场时。
Problem comes when the description or header have a comma. I need a
little javascript that will replace the comma with a semicolon client
side before it gets to the server, preferably as they leave the field.
我怀疑你可以在服务器之前做任何事情,
Adrienne。
Clientside很简单,只需要进行正则表达式全局替换。
-
Evertjan。
荷兰。
(请将x''es更改为我的电子邮件地址中的点数)
I doubt you can do anything serverside before it gets to the server,
Adrienne.
Clientside it is simple, just do a regex global replace.
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
Adrienne Boswell写道:
Adrienne Boswell wrote:
当描述或标题有逗号时出现问题。我需要
a一些javascript,它会在它到达服务器之前用分号
客户端替换逗号,最好是因为它们离开
领域。
Problem comes when the description or header have a comma. I need
a little javascript that will replace the comma with a semicolon
client side before it gets to the server, preferably as they leave
the field.
假设从你的例子中你想要你的onblur
处理程序的表达式,这里有一种方法:
onblur =" this.value = this.value.split('','')。join('';'')"
另一个:
onblur =" this.value = this.value.replace(/,/ g,'';'')"
-
戴夫安德森
未经请求的商业电子邮件将以每封邮件
Assuming from your example that you want the expression for your onblur
handler, here is one way:
onblur="this.value=this.value.split('','').join('';'') "
Another:
onblur="this.value=this.value.replace(/,/g,'';'')"
--
Dave Anderson
Unsolicited commercial email will be read at a cost of
500的费用阅读。使用
这个电子邮件地址的
表示同意这些条款。
500 per message. Use
of this email address implies consent to these terms.
这篇关于替换数组中值的逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!