JavaScript - 隐藏/显示文本框 [英] JavaScript - HIDE/DISPLAY text boxes

查看:154
本文介绍了JavaScript - 隐藏/显示文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计....我绝对没有想到我正在用Javascript做什么

但我的最终结果是我需要两个文本框才能保持隐藏状态直到

选择了特定的选项....我已经从几个不同的网站拼凑了这个代码中的JavaScript

但是我不是100%肯定是什么

每行都在做...这是我用于

页面的ASP代码....看看JavaScript代码,请告诉我什么

每一行都在做....我已经成功隐藏了两个文本

盒子(''ccnumber''和''expdate'')但是可以现在没有显示它们

....


此外,你可以指导我的任何好网站,这样我就可以学到很多

得到......我已经尝试了一对,但他们并没有解释得太好......


*****开始代码*****


<! - #INCLUDE VIRTUAL =" / _ borders / top_nav.asp" - >


<%

Mode = Request(" mode")

CSRName = Request.Form( " csrname")

CSRExt = Request.Form(" csrext")

CSREmail = Request.Form(" csremail")

CustName = Request.Form(" custname")

CustAddress = Request.Form(" custaddress")

CityStateZip = Request.Form(" citystatezip")

CustPhone = Request.Form(" custphonenbr")

EcomOrder = Request.Form(" ecomnumber")

CustExpect = Request。表格(custexpect)

GCNumber = Request.Form(" gcnumber")

PIN = Request.Form(" pin")

原因= Request.Form(原因)

解决方案= Request.Form(解决方案)

CCNumber = Request.Form(" ccnumber" ;)


''********************************** *************** ****************************

'' *数据输入表格

*

''************************** *********************** *************************** *

子表格()

Response.Write"< p>< font size =''1''>礼品卡兑换表格为<当客户报告礼品卡丢失或

Response.Write时使用
被盗,新礼品卡的订单在

过境中丢失,或者客户要求退还

Response.Write礼品卡以退款通过检查。< / font>< / p>"

Response.Write"< form method =''POST''action =''Gift_Card_Redemption.asp''

name =''gcredeem''onSubmit =''validate()''>"

Response.Write"& nbsp;< div align =''left ''>"

Response.Write"< table border =''0''cellpadding =''0''width =''666''>"


Response.Write"< tr>"

Response.Write"< td width =''153''> CSR'的名称:< / td>"

Response.Write"< td width =''503''>< input type =''text''name =''csrname''

size =''20''>< / td>"

Response.Write"< / tr>"


Response.Write"< tr>"

Response.Write"< td width =''153''> CSR'的Ext。 :< / td>"

Response.Write"< td width =''503''>< input type =''text''name =''csrext''

size =''20''>< / td>"

Response.Write"< / tr>"


Response.Write"< tr>"

Response.Write"< td width =''153''> CSR'的电子邮件:< / td>"

Response.Write"< td width =''503''>< input type =''text''name =''csremail''

size =''20''>< / td>"

Response.Write"< / tr>"


Response.Write"< tr>"

Response.Write"< td width =''153''>客户名称:< / td>

Response.Write"< td width =''503''>< input type =''text''name =''custname''

size ='''20''>< / td>"

Response.Write"< / tr>&q uot;


Response.Write"< tr>"

Response.Write"< td width =''153''valign = ''top''>客户地址:< / td>"

Response.Write"< td width =''503''>< input type =''text ''name =''custaddress''

size =''20''>< / td>"

Response.Write"< / tr> ;"


Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top''>城市/州/邮编

:< / td>"

Response.Write"< td width =''503 ''>"

Response.Write"< input type =''text''name =''citystatezip''cols ='''43''

size ='''20''>< / textarea>< / td>"

Response.Write"< / tr>"


Response.Write"< tr>"

Response.Write"< t d width ='''153''valign =''top''>客户电话号码

:< / td>"

Response.Write"< ; td width ='''503''>"

Response.Write"< input type =''text''name =''custphonenbr''cols =''43''

size =''20''>< / textarea>< / td>"

Response.Write"< / tr>"


Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top ''> Ecometry订单#:< / td>"

Response.Write"< td width ='''503''>"

Response.Write"< input type =''text''name =''ecomnumber''cols ='''43''

size ='''20''>< / textarea> ;< / td>"

Response.Write"< / tr>"


Response.Write"< tr>" ;

Response.Write"< td width ='''253' 'valign =''top''>客户的预期

美元金额:< / td>"

Response.Write"< td width ='''503''> $"

Response.Write"< input type =''text''name =''custexpect''cols ='''43''

size =''20''>< / textarea>< / td>"

Response.Write"< / tr>"


Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top'' >礼品卡#:< / td>"

Response.Write"< td width =''503''>"

回复。写< input type =''text''name =''gcnumber''cols ='''43''

size ='''20''>< / textarea>< ; / td>"

Response.Write"< / tr>"


Response.Write"< tr>"

Response.Write"< td width =''153''valign = ''top''> PIN#< / td>"

Response.Write"< td width =''503''>"

Response.Write"< input type =''text''name =''pin''cols ='''43''

size ='''20''>< / textarea>< / td>"

Response.Write"< / tr>"

Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top''>& nbsp;< / td>"

回复.Write"< td width =''503''>& nbsp;"


Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top''>原因:< / td>"

Response.Write"< ; td width ='''503''>"

Response.Write"< select size =''1''name =''reason''>"

Response.Write"< option selected>选择From List< / optio n>"

Response.Write"< option>兑换GC余额用于支票退款< / option>"

Response.Write"< option> GC丢失或被盗< /选项>"

Response.Write"<选项> GC在运输中丢失< /选项>"

Response.Write "< / select>"


Response.Write"< tr>"

Response.Write"< td width = ''153''valign =''top''>解决方案:< / td>"

Response.Write"< td width =''503''>"

%>


< script type =''javascript''>


// RETURNS风格对象

函数getStyle(名称){

if(document.getElementById){return

document.getElementById(name).style; }

else if(document.all){return document.all [name] .style;}

else if(document.layers){return document.layers [name ];}

}


//处理选择框中的更改

函数checkInput(value){

if(value ==''credit''){show (''ccnumber'',''expdate'')}

else {hide(''cc'',''exp'')}

// else返回;

}


//更改元素ID的显示属性以阻止

功能显示(id ){

var styleObj = getStyle(id);

styleObj.display =''block'';

}


//更改元素ID的显示属性无法使用

函数hide(id){

var styleObj = getStyle(id );

styleObj.display =''none'';

}

< / script>


< select name =''solution''size =''1''value =''''

onchange =''checkInput(value)''>

< option value =''none''>选择From List< / option>

< option value =''replace''> R eplacement GC< / option>

< option value =''check''> Check Refund< / option>

< option value =''credit'' >信用卡< / option>

< / select>


< br>

< tr> ;

< td width =''153''valign =''top''>< span id =''cc''style =" display:none;">

信用卡号< / td>

< td width =''503''>< span id =''ccnumber''style =" display :none;">

< textarea cols =''25''rows ='''''> Fluffy bunnies suck< / textarea>

< ;! - < input type =''text''name =''ccnumber''id =''cc''> - >< / span>

< br> ;

< tr>

< td width =''153''valign =''top''>< span id =''exp'' style =" display:none;">

到期日期< / td>

& lt; td width =''503''>< span id =''expdate''style =" display:none;">

< input type =''text ''name =''expdate''id =''exp''size =" 20">< / span>

< / span>< / span>


<%

Response.Write"< td width =''503''>& nbsp;"

Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top''>& nbsp;< / td>"

Response.Write"< td width =''503''>& nbsp;< / td>"

Response.Write"< / tr>"

Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top''>& nbsp;< / td>"

Response.Write"< td width =''503'' >"

Response.Write"< input type =''submit''value =''发送我ssage''

name =''Send''>< / td>"

Response.Write"< / tr>"

Response.Write"< / table>"

Response.Write"< / div>"

Response.Write" < input type =''hidden''name =''mode''value =''发送''>"

Response.Write"< / form>"

Response.Write"< p>< a href =''.. / default.asp''>返回给最终用户

消费者服务< / a>< ; / p>"

结束子

''************************ ************************* *

''*电子邮件声明*

'' *************************************************

子邮件()

设置Mail = Server.CreateObject(" Persits.MailSender")

Mail.Host =" gwfs1" ''指定有效的SMTP服务器

Mail.From = CSREmail''指定发件人的地址

Mail.FromName = CSREmail''指定发件人的姓名

Mail.IsHTML = True

Mail.Subject =原因


Dim mail_body


mail_body =" CSR'的名称:" &安培; CSRName& "<峰; br>" & _

" CSR''s Ext:" &安培; CSRExt& "<峰; br>" & _

"客户名称:" &安培; CustName& "<峰; br>" & _

"客户的电话号码:" &安培; CustPhone& "<峰; br>" & _

"客户地址:" &安培; CustAddress& "<峰; br>" & _

" City / State / Zip:" &安培; CityStateZip& "<峰; br>" & _

" Ecometry Order#:" &安培; EcomOrder& "<峰; br>" & _

"客户'的预期美元金额:" &安培; CustExpect& "<峰; br>" & _

"礼品卡#:" &安培; GCNumber& "<峰; br>" & _

" PIN:" &安培; PIN& "<峰; br>" & _

" Reason:" &安培;理由& "<峰; br>" & _

"解决方案:" &安培;解决方案& "<峰; br>" & _

"信用卡号码:" &安培; CCNumber& "< br>"


mail.body = mail_body& request.servervariables(" REMOTE_ADDR")

On Error Resume Next

Mail.Send

如果Err<> 0然后

Response.Write遇到错误: &安培; Err.Description

结束如果

结束子

''***************** ******************************** ****************** **********


''************************** *********************** *************************** *

''* DATABASE APPENDING

*

''***************** ******************************** ****************** **********

子数据库()

''创建数据库连接

设置gcredemption = Server.CreateObject( ADODB.Connection)


''在无DSN方法中打开数据库

gcredemption.Open" PROVIDER = MICROSOFT.JET.OLEDB。 4.0; DATA SOURCE ="&

Server.MapPath(" /jax/CS/eucs/Online_Forms/Secured_Archives/eucs.mdb")


''INSERT语句的正确语法'INSERT INTO

< tablename>(< fieldname>)VALUES(< data>)"

stateSQL =" ;插入 gcredemption(csr_name,csr_ext,cust_name,

地址,city_state_zip,phone_number,ecom_order,expected,

giftcard_number,pin,reason,solution,cc_number)" & _

" VALUES(''"& Replace(CSRName,"''","''''"&"'''''' "&

替换(CSRExt,"''",'''''''&"'',''"& Replace(CustName,& ;''",''''''")&"'',''"

& _

替换(CustAddress,& ;''",'''''")&"'',''"&

替换(CityStateZip,"''","' ''''"&"'',''"&替换(CustPhone,"''","''''"&

" ;'',''"& _

替换(EcomOrder,"''","''''''&"''',''" & Replace(CustExpect,"'","''''")

&"'',''"& Replace(GCNumber,"' '","' '''") &"'',''"& _

替换(PIN,"''","''''""''''' '"& Reason&"'',''"& Solution&"'',''" &

CCNumber& ''')"


''在屏幕上显示语句结果以用于测试目的

Response.Write(stateSQL)


''提醒SQL语句它的工作原理

gcredemption.Execute(stateSQL)


''围绕数据库连接直到它放开了

gcredemption.Close


''用极端的偏见杀死连接

set gcredemption = nothing


结束次级

''****************************** ******************* ****************************

''*************************************** ********** ****************************

''*确认输入数据后的页面

*

''*************************** ********************** ****************************

子确认()

Response.Write"< h2>< img border =''0''

src =' ../../../images/su ccess.jpg''>< / h2>"

Response.Write"< p>以下消息已成功提交

已提交!< / p>"

Response.Write" CSR'的名称:< font color =''#0000FF''>" &安培; CSRName&

"< / font>< br>"

Response.Write" CSR'的Ext。 :< font color =''#0000FF''>" &安培; CSRExt&

"< / font>< br>"

Response.Write"客户名称:< font color ='' #0000FF '' >" &安培; CustName

& "< / font>< br>"

Response.Write" Customer Phone#:< font color =''#0000FF''>" &

CustPhone& "< / font>< br>"

Response.Write" Customer''s Address:< font color =''#0000FF''>" &

CustAddress& "< / font>< br>"

Response.Write" City / State / Zip:< font color =''#0000FF''>" &

CityStateZip& "< / font>< br>"

Response.Write" Ecometry Order#:< font color =''#0000FF''>" &

EcomOrder& "< / font>< br>"

Response.Write"客户'的预期美元金额:< font

color =''# 0000FF '' >" &安培; CustExpect& "< / font>< br>"

Response.Write" Gift Card#:< font color =''#0000FF''>" &安培; GCNumber&

"< / font>< br>"

Response.Write" PIN:< font color =''#0000FF'' >" &安培; PIN& "< / font>< br>"

Response.Write" Reason:< font color =''#0000FF''>" &安培;原因&

"< / font>< br>"

Response.Write"解决方案:< font color =''#0000FF'' >" &安培;解决方案&

"< / font>< br>"

Response.Write"信用卡#:< font color =''#0000FF '' >" &安培; CCNumber&

"< p>& nbsp;< / p>"

Response.Write"< p>< a href =' '../default.asp''>返回给最终用户

消费者服务< / a>< / p>"

End Sub

''******************************************** ***** ****************************


Response.Write" < title>礼品卡兑换< / title>"


如果模式<> "发送和QUOT;然后

致电表格

结束如果


如果Mode ="发送&#然后

''来电验证

来电数据库

来电邮件

结束如果

''如果Validated_Form = True那么

''致电邮件

''调用FileAppend

''调用数据库

''来电确认

''结束如果


%><! - #INCLUDE VIRTUAL =" / _ border /bottom_nav.asp" - >


*****代码结束*****

Hi guys....I have absolutely NO IDEA what I''m doing with Javascript
but my end result is I need two text boxes to stay hidden until a
particular option is selected....I''ve cobbled together the JavaScript
in this code from a couple different sites but I''m not 100% sure what
each line is doing...This is the ASP code that I''m using for the
page....Take a look at the JavaScript code and please let me know what
each line is doing....I have been successful in hiding the two text
boxes in question (''ccnumber'' and ''expdate'') but can''t display them
now....

Also, any good sites that you can direct me to so I can learn enough
to get by....I''ve tried a couple but they didn''t explain too well...

*****START OF CODE*****

<!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->

<%
Mode = Request("mode")
CSRName = Request.Form("csrname")
CSRExt = Request.Form("csrext")
CSREmail = Request.Form("csremail")
CustName = Request.Form("custname")
CustAddress = Request.Form("custaddress")
CityStateZip = Request.Form("citystatezip")
CustPhone = Request.Form("custphonenbr")
EcomOrder = Request.Form("ecomnumber")
CustExpect = Request.Form("custexpect")
GCNumber = Request.Form("gcnumber")
PIN = Request.Form("pin")
Reason = Request.Form("reason")
Solution = Request.Form("solution")
CCNumber = Request.Form("ccnumber")

''************************************************* ****************************
''* FORM FOR DATA INPUT
*
''************************************************* ****************************
Sub Form()
Response.Write "<p><font size=''1''>Gift Card Redemption form is to be
used when a customer reports a Gift Card as lost or "
Response.Write " stolen, an order for a new Gift Card was lost in
transit, or the customer requests the balance on a "
Response.Write "gift card to be refunded by check.</font></p>"
Response.Write "<form method=''POST'' action=''Gift_Card_Redemption.asp''
name=''gcredeem'' onSubmit=''validate()''>"
Response.Write "&nbsp;<div align=''left''>"
Response.Write "<table border=''0'' cellpadding=''0'' width=''666''>"

Response.Write "<tr>"
Response.Write "<td width=''153''>CSR''s Name :</td>"
Response.Write "<td width=''503''><input type=''text'' name=''csrname''
size=''20''></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153''>CSR''s Ext. :</td>"
Response.Write "<td width=''503''><input type=''text'' name=''csrext''
size=''20''></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153''>CSR''s Email :</td>"
Response.Write "<td width=''503''><input type=''text'' name=''csremail''
size=''20''></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153''>Customer''s Name :</td>"
Response.Write "<td width=''503''><input type=''text'' name=''custname''
size=''20''></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>Customer Address :</td>"
Response.Write "<td width=''503''><input type=''text'' name=''custaddress''
size=''20''></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>City / State / Zip
:</td>"
Response.Write "<td width=''503''>"
Response.Write "<input type=''text'' name=''citystatezip'' cols=''43''
size=''20''></textarea></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>Customer Phone Number
:</td>"
Response.Write "<td width=''503''>"
Response.Write "<input type=''text'' name=''custphonenbr'' cols=''43''
size=''20''></textarea></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>Ecometry Order # :</td>"
Response.Write "<td width=''503''>"
Response.Write "<input type=''text'' name=''ecomnumber'' cols=''43''
size=''20''></textarea></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''253'' valign=''top''>Customer''s Expected
Dollar Amount :</td>"
Response.Write "<td width=''503''>$"
Response.Write "<input type=''text'' name=''custexpect'' cols=''43''
size=''20''></textarea></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>Gift Card # :</td>"
Response.Write "<td width=''503''>"
Response.Write "<input type=''text'' name=''gcnumber'' cols=''43''
size=''20''></textarea></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>PIN # </td>"
Response.Write "<td width=''503''>"
Response.Write "<input type=''text'' name=''pin'' cols=''43''
size=''20''></textarea></td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>&nbsp;</td>"
Response.Write "<td width=''503''>&nbsp;"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>Reason :</td>"
Response.Write "<td width=''503''>"
Response.Write "<select size=''1'' name=''reason''>"
Response.Write "<option selected>Choose From List</option>"
Response.Write "<option>Redeem GC Balance For Check Refund</option>"
Response.Write "<option>GC Was Lost Or Stolen</option>"
Response.Write "<option>GC Was Lost In Transit</option>"
Response.Write "</select>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>Solution :</td>"
Response.Write "<td width=''503''>"
%>

<script type=''javascript''>

//RETURNS THE STYLE OBJECT
function getStyle(name){
if (document.getElementById){return
document.getElementById(name).style;}
else if (document.all){return document.all[name].style;}
else if (document.layers){return document.layers[name];}
}

//HANDLES THE CHANGE IN SELECT BOX
function checkInput(value){
if (value==''credit''){show(''ccnumber'', ''expdate'')}
else {hide(''cc'', ''exp'')}
// else return;
}

//CHANGES THE DISPLAY PROPERTY OF ELEMENT ''ID'' TO BLOCK
function show(id){
var styleObj=getStyle(id);
styleObj.display=''block'';
}

//CHANGES THE DISPLAY PROPERTY OF ELEMENT ''ID'' TO NONE
function hide(id){
var styleObj=getStyle(id);
styleObj.display=''none'';
}
</script>

<select name=''solution'' size=''1'' value=''''
onchange=''checkInput(value)''>
<option value=''none''>Choose From List</option>
<option value=''replace''>Replacement GC</option>
<option value=''check''>Check Refund</option>
<option value=''credit''>Credit to Credit Card</option>
</select>

<br>
<tr>
<td width=''153'' valign=''top''><span id=''cc'' style="display: none;">
Credit Card Number</td>
<td width=''503''><span id=''ccnumber'' style="display: none;">
<textarea cols=''25'' rows=''1''>Fluffy bunnies suck</textarea>
<!--<input type=''text'' name=''ccnumber'' id=''cc''>--></span>
<br>
<tr>
<td width=''153'' valign=''top''><span id=''exp'' style="display: none;">
Expiration Date</td>
<td width=''503''><span id=''expdate'' style="display: none;">
<input type=''text'' name=''expdate'' id=''exp'' size="20"></span>
</span></span>

<%
Response.Write "<td width=''503''>&nbsp;"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>&nbsp;</td>"
Response.Write "<td width=''503''>&nbsp;</td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>&nbsp;</td>"
Response.Write "<td width=''503''>"
Response.Write "<input type=''submit'' value=''Send Message''
name=''Send''></td>"
Response.Write "</tr>"
Response.Write "</table>"
Response.Write "</div>"
Response.Write "<input type=''hidden'' name=''mode'' value=''Send''>"
Response.Write "</form>"
Response.Write"<p><a href=''../default.asp''>Return to End User
Consumer Service</a></p>"
End Sub
''************************************************* *
''* EMAIL STATEMENT *
''************************************************* *
Sub Mail()
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "gwfs1" '' Specify a valid SMTP server
Mail.From = CSREmail '' Specify sender''s address
Mail.FromName = CSREmail '' Specify sender''s name
Mail.IsHTML = True
Mail.Subject = Reason

Dim mail_body

mail_body = "CSR''s Name : " & CSRName & "<br>" &_
"CSR''s Ext : " & CSRExt & "<br>" &_
"Customer Name : " & CustName & "<br>" &_
"Customer''s Phone Number : " & CustPhone & "<br>" &_
"Customer''s Address : " & CustAddress & "<br>" &_
"City / State / Zip : " & CityStateZip & "<br>" &_
"Ecometry Order # : " & EcomOrder & "<br>" &_
"Customer''s Expected Dollar Amount : " & CustExpect & "<br>" &_
"Gift Card # : " & GCNumber & "<br>" &_
"PIN : " & PIN & "<br>" &_
"Reason : " & Reason & "<br>" &_
"Solution : " & Solution & "<br>" &_
"Credit Card Number : " & CCNumber & "<br>"

mail.body = mail_body & request.servervariables("REMOTE_ADDR")

On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
End Sub
''************************************************* ****************************

''************************************************* ****************************
''* DATABASE APPENDING
*
''************************************************* ****************************
Sub Database()
''create db connection
Set gcredemption = Server.CreateObject("ADODB.Connection")

''open db in a DSN-less method
gcredemption.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
Server.MapPath("/jax/CS/eucs/Online_Forms/Secured_Archives/eucs.mdb")

''correct syntax for INSERT statement "INSERT INTO
<tablename>(<fieldname>) VALUES (<data>)"
stateSQL = "INSERT INTO gcredemption(csr_name, csr_ext, cust_name,
address, city_state_zip, phone_number, ecom_order, expected,
giftcard_number, pin, reason, solution, cc_number) " &_
"VALUES (''" & Replace(CSRName,"''","''''") & "'',''" &
Replace(CSRExt,"''","''''") & "'',''" & Replace(CustName,"''","''''") & "'',''"
&_
Replace(CustAddress,"''","''''") & "'',''" &
Replace(CityStateZip,"''","''''") & "'',''" & Replace(CustPhone,"''","''''") &
"'',''" &_
Replace(EcomOrder,"''","''''") & "'',''" & Replace(CustExpect,"''","''''")
& "'',''" & Replace(GCNumber,"''","''''") & "'',''" &_
Replace(PIN,"''","''''") & "'',''" & Reason & "'',''" & Solution & "'',''" &
CCNumber & "'')"

''display results of statement on screen for testing purposes
Response.Write(stateSQL)

''remind the SQL statement who it works for
gcredemption.Execute(stateSQL)

''smack around the db connection until it lets go
gcredemption.Close

''kill the connection with extreme prejudice
set gcredemption = nothing

End Sub
''************************************************* ****************************

''************************************************* ****************************
''* CONFIRMATION PAGE AFTER ENTERING DATA
*
''************************************************* ****************************
Sub Confirm()
Response.Write "<h2><img border=''0''
src=''../../../images/success.jpg''></h2>"
Response.Write "<p>The following message has been successfully
submitted!</p>"
Response.Write "CSR''s Name : <font color=''#0000FF''>" & CSRName &
"</font><br>"
Response.Write "CSR''s Ext. : <font color=''#0000FF''>" & CSRExt &
"</font><br>"
Response.Write "Customer''s Name : <font color=''#0000FF''>" & CustName
& "</font><br>"
Response.Write "Customer Phone # : <font color=''#0000FF''>" &
CustPhone & "</font><br>"
Response.Write "Customer''s Address : <font color=''#0000FF''>" &
CustAddress & "</font><br>"
Response.Write "City / State / Zip : <font color=''#0000FF''>" &
CityStateZip & "</font><br>"
Response.Write "Ecometry Order # : <font color=''#0000FF''>" &
EcomOrder & "</font><br>"
Response.Write "Customer''s Expected Dollar Amount : <font
color=''#0000FF''>" & CustExpect & "</font><br>"
Response.Write "Gift Card # : <font color=''#0000FF''>" & GCNumber &
"</font><br>"
Response.Write "PIN : <font color=''#0000FF''>" & PIN & "</font><br>"
Response.Write "Reason : <font color=''#0000FF''>" & Reason &
"</font><br>"
Response.Write "Solution : <font color=''#0000FF''>" & Solution &
"</font><br>"
Response.Write "Credit Card # : <font color=''#0000FF''>" & CCNumber &
"<p>&nbsp;</p>"
Response.Write"<p><a href=''../default.asp''>Return to End User
Consumer Service</a></p>"
End Sub
''************************************************* ****************************

Response.Write "<title>Gift Card Redemption</title>"

If Mode <> "Send" Then
Call Form
End If

If Mode = "Send" Then
'' Call Validation
Call Database
Call Mail
End If

''If Validated_Form = True Then
'' Call Mail
'' Call FileAppend
'' Call Database
'' Call Confirm
''End If

%><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->

*****END OF CODE*****

推荐答案



Response.Write"< input type =''text''name =''custexpect''cols ='''43''

size =' '20''>< / textarea>< / td>"

Response.Write"< / tr>"


Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top''>礼品卡#:< / td>"

Response.Write"< td width =''503''>"

Response.Write"< input type =' 'text''name =''gcnumber''cols ='''43''

size ='''20''>< / textarea>< / td>"

Response.Write"< / tr>"


Response.Write"< tr>"

响应。写上< td width =''153''valign =''top''> PIN#< / td>"

回复se.Write"< td width =''503''>"

Response.Write"< input type =''text''name =''pin''cols ='''43''

size ='''20''>< / textarea>< / td>"

Response.Write"< / tr>"

Response.Write"< tr>"

Response.Write"< td width =''153''valign =' 'top''>& nbsp;< / td>"

Response.Write"< td width =''503''>& nbsp;"


Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top' '>原因:< / td>"

Response.Write"< td width =''503''>"

Response.Write "< select size =''1''name =''reason''>"

Response.Write"< option selected> Choose From List< / option>"

Response.Write"< option> Re认为检查退款的GC余额< /选项>"

Response.Write"<选项> GC丢失或被盗< / option>"

回复。写下<选项> GC已丢失在公交中< /选项>"

Response.Write"< / select>"


Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top''>解决方案:< / td>

Response.Write"< td width =''503''>"

%>


< script type =''javascript''>


//回归风格对象

函数getStyle(名称){

if(document.getElementById){return

document.getElementById(name).style;}

else if(document.all){return document.all [name] .style;}

else if(document.layers){return document.layers [name];}

}


//处理选择框中的更改

fun ction checkInput(value){

if(value ==''credit''){show(''ccnumber'',''expdate'')}

else {hide(''cc'',''exp'')}

//否则返回;

}


//更改元素ID的显示属性以阻止

功能显示(id){

var styleObj = getStyle(id);

styleObj.display =''block'';

}


//更改元素ID的显示属性
函数hide(id){

var styleObj = getStyle(id);

styleObj.display =''none'';

}

< / script>


< select name =''solution''size =''1''value = ''''

onchange =''checkInput(value)''>

< option value =''none''>从列表中选择< / option> ;

< option value =''replace''>替换GC< / option>

< option value =' 'check''> Check Refund< / option>

< option value =''credit''>信用卡< / option>

< / select>


< br>

< tr>

< td width =''153''valign =''top''>< span id =''cc''style =" display:none;">

信用卡号< / td>

< td width =''503''>< span id =''ccnumber''style =" display:none;">

< textarea cols = ''25''rows =''1''>蓬松的兔子吮吸< / textarea>

<! - < input type =''text''name =''ccnumber' 'id =''cc''> - >< / span>

< br>

< tr>

< td width =''153''valign =''top''>< span id =''exp''style =" display:none;">

到期日期< / td>

< td width =''503''>< span id =''expdate' style =" display:none;">

< input type =''text''name =''expdate''id =''exp''size =" 20" >< / span>

< / span>< / span>


<%

回复。写下< td width =''503''>& nbsp;"


Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top''>& nbsp;< / td>"

Response.Write" < td width =''503''>& nbsp;< / td>"

Response.Write"< / tr>"

Response.Write"< tr>"

Response.Write"< td width =''153''valign =''top''>& nbsp;< / td>"

Response.Write"< td width =''503''>"

Response.Write"< input type = ''submit''value =''发送消息''

name =''发送''>< / td>& ;

Response.Write"< / tr>"

Response.Write"< / table>"

Response.Write"< / div>"

Response.Write"< input type =''hidden''name =''mode''value ='''Send''> ;"

Response.Write"< / form>"

Response.Write"< p>< a href =''.. / default .asp''>返回给最终用户

消费者服务< / a>< / p>"

结束子

' ******************* *

''*电子邮件声明*

''************************* ************************ *

子邮件()

设置邮件=服务器。 CreateObject(" Persits.MailSender")

Mail.Host =" gwfs1" ''指定有效的SMTP服务器

Mail.From = CSREmail''指定发件人的地址

Mail.FromName = CSREmail''指定发件人的姓名

Mail.IsHTML = True

Mail.Subject =原因


Dim mail_body


mail_body =" CSR'的名称:" &安培; CSRName& "<峰; br>" & _

" CSR''s Ext:" &安培; CSRExt& "<峰; br>" & _

"客户名称:" &安培; CustName& "<峰; br>" & _

"客户的电话号码:" &安培; CustPhone& "<峰; br>" & _

"客户地址:" &安培; CustAddress& "<峰; br>" & _

" City / State / Zip:" &安培; CityStateZip& "<峰; br>" & _

" Ecometry Order#:" &安培; EcomOrder& "<峰; br>" & _

"客户'的预期美元金额:" &安培; CustExpect& "<峰; br>" & _

"礼品卡#:" &安培; GCNumber& "<峰; br>" & _

" PIN:" &安培; PIN& "<峰; br>" & _

" Reason:" &安培;理由& "<峰; br>" & _

"解决方案:" &安培;解决方案& "<峰; br>" & _

"信用卡号码:" &安培; CCNumber& "< br>"


mail.body = mail_body& request.servervariables(" REMOTE_ADDR")

On Error Resume Next

Mail.Send

如果Err<> 0然后

Response.Write遇到错误: &安培; Err.Description

结束如果

结束子

''***************** ******************************** ****************** **********


''************************** *********************** *************************** *

''* DATABASE APPENDING

*

''***************** ******************************** ****************** **********

子数据库()

''创建数据库连接

设置gcredemption = Server.CreateObject( ADODB.Connection)


''在无DSN方法中打开数据库

gcredemption.Open" PROVIDER = MICROSOFT.JET.OLEDB。 4.0; DATA SOURCE ="&

Server.MapPath(" /jax/CS/eucs/Online_Forms/Secured_Archives/eucs.mdb")


''INSERT语句的正确语法'INSERT INTO

< tablename>(< fieldname>)VALUES(< data>)"

stateSQL =" ;插入 gcredemption(csr_name,csr_ext,cust_name,

地址,city_state_zip,phone_number,ecom_order,expected,

giftcard_number,pin,reason,solution,cc_number)" & _

" VALUES(''"& Replace(CSRName,"''","''''"&"'''''' "&

替换(CSRExt,"''",'''''''&"'',''"& Replace(CustName,& ;''",''''''")&"'',''"

& _

替换(CustAddress,& ;''",'''''")&"'',''"&

替换(CityStateZip,"''","' ''''"&"'',''"&替换(CustPhone,"''","''''"&

" ;'',''"& _

替换(EcomOrder,"''","''''''&"''',''" & Replace(CustExpect,"'","''''")

&"'',''"& Replace(GCNumber,"' '","' '''") &"'',''"& _

替换(PIN,"''","''''""''''' '"& Reason&"'',''"& Solution&"'',''" &

CCNumber& ''')"


''在屏幕上显示语句结果以用于测试目的

Response.Write(stateSQL)


''提醒SQL语句它的工作原理

gcredemption.Execute(stateSQL)


''围绕数据库连接直到它放开了

gcredemption.Close


''用极端的偏见杀死连接

set gcredemption = nothing


结束次级

''****************************** ******************* ****************************

''*************************************** ********** ****************************

''*确认输入数据后的页面

*

''*************************** ********************** ****************************

子确认()

Response.Write"< h2>< img border =''0''

src =' ../../../images/su ccess.jpg''>< / h2>"

Response.Write"< p>以下消息已成功提交

已提交!< / p>"

Response.Write" CSR'的名称:< font color =''#0000FF''>" &安培; CSRName&

"< / font>< br>"

Response.Write" CSR'的Ext。 : <font color=’’#0000FF’’>" &安培; CSRExt &

"</font><br>"

Response.Write "Customer’’s Name : <font color=’’#0000FF’’>" &安培; CustName

& "</font><br>"

Response.Write "Customer Phone # : <font color=’’#0000FF’’>" &

CustPhone & "</font><br>"

Response.Write "Customer’’s Address : <font color=’’#0000FF’’>" &

CustAddress & "</font><br>"

Response.Write "City / State / Zip : <font color=’’#0000FF’’>" &

CityStateZip & "</font><br>"

Response.Write "Ecometry Order # : <font color=’’#0000FF’’>" &

EcomOrder & "</font><br>"

Response.Write "Customer’’s Expected Dollar Amount : <font

color=’’#0000FF’’>" &安培; CustExpect & "</font><br>"

Response.Write "Gift Card # : <font color=’’#0000FF’’>" &安培; GCNumber &

"</font><br>"

Response.Write "PIN : <font color=’’#0000FF’’>" &安培; PIN & "</font><br>"

Response.Write "Reason : <font color=’’#0000FF’’>" &安培; Reason &

"</font><br>"

Response.Write "Solution : <font color=’’#0000FF’’>" &安培; Solution &

"</font><br>"

Response.Write "Credit Card # : <font color=’’#0000FF’’>" &安培; CCNumber &

"<p>&nbsp;</p>"

Response.Write"<p><a href=’’../default.asp’’>Return to End User

Consumer Service</a></p>"

End Sub

’’************************************************* ****************************


Response.Write "<title>Gift Card Redemption</title>"


If Mode <> "Send" Then

Call Form

End If


If Mode = "Send" Then

’’\tCall Validation

Call Database

Call Mail

End If


’’If Validated_Form = True Then

’’\tCall Mail

’’\tCall FileAppend

’’\tCall Database

’’\tCall Confirm

’’End If


%><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->


*****END OF CODE*****
"
Response.Write "<input type=''text'' name=''custexpect'' cols=''43''
size=''20''></textarea></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>Gift Card # :</td>"
Response.Write "<td width=''503''>"
Response.Write "<input type=''text'' name=''gcnumber'' cols=''43''
size=''20''></textarea></td>"
Response.Write "</tr>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>PIN # </td>"
Response.Write "<td width=''503''>"
Response.Write "<input type=''text'' name=''pin'' cols=''43''
size=''20''></textarea></td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>&nbsp;</td>"
Response.Write "<td width=''503''>&nbsp;"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>Reason :</td>"
Response.Write "<td width=''503''>"
Response.Write "<select size=''1'' name=''reason''>"
Response.Write "<option selected>Choose From List</option>"
Response.Write "<option>Redeem GC Balance For Check Refund</option>"
Response.Write "<option>GC Was Lost Or Stolen</option>"
Response.Write "<option>GC Was Lost In Transit</option>"
Response.Write "</select>"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>Solution :</td>"
Response.Write "<td width=''503''>"
%>

<script type=''javascript''>

//RETURNS THE STYLE OBJECT
function getStyle(name){
if (document.getElementById){return
document.getElementById(name).style;}
else if (document.all){return document.all[name].style;}
else if (document.layers){return document.layers[name];}
}

//HANDLES THE CHANGE IN SELECT BOX
function checkInput(value){
if (value==''credit''){show(''ccnumber'', ''expdate'')}
else {hide(''cc'', ''exp'')}
// else return;
}

//CHANGES THE DISPLAY PROPERTY OF ELEMENT ''ID'' TO BLOCK
function show(id){
var styleObj=getStyle(id);
styleObj.display=''block'';
}

//CHANGES THE DISPLAY PROPERTY OF ELEMENT ''ID'' TO NONE
function hide(id){
var styleObj=getStyle(id);
styleObj.display=''none'';
}
</script>

<select name=''solution'' size=''1'' value=''''
onchange=''checkInput(value)''>
<option value=''none''>Choose From List</option>
<option value=''replace''>Replacement GC</option>
<option value=''check''>Check Refund</option>
<option value=''credit''>Credit to Credit Card</option>
</select>

<br>
<tr>
<td width=''153'' valign=''top''><span id=''cc'' style="display: none;">
Credit Card Number</td>
<td width=''503''><span id=''ccnumber'' style="display: none;">
<textarea cols=''25'' rows=''1''>Fluffy bunnies suck</textarea>
<!--<input type=''text'' name=''ccnumber'' id=''cc''>--></span>
<br>
<tr>
<td width=''153'' valign=''top''><span id=''exp'' style="display: none;">
Expiration Date</td>
<td width=''503''><span id=''expdate'' style="display: none;">
<input type=''text'' name=''expdate'' id=''exp'' size="20"></span>
</span></span>

<%
Response.Write "<td width=''503''>&nbsp;"

Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>&nbsp;</td>"
Response.Write "<td width=''503''>&nbsp;</td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width=''153'' valign=''top''>&nbsp;</td>"
Response.Write "<td width=''503''>"
Response.Write "<input type=''submit'' value=''Send Message''
name=''Send''></td>"
Response.Write "</tr>"
Response.Write "</table>"
Response.Write "</div>"
Response.Write "<input type=''hidden'' name=''mode'' value=''Send''>"
Response.Write "</form>"
Response.Write"<p><a href=''../default.asp''>Return to End User
Consumer Service</a></p>"
End Sub
''************************************************* *
''* EMAIL STATEMENT *
''************************************************* *
Sub Mail()
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "gwfs1" '' Specify a valid SMTP server
Mail.From = CSREmail '' Specify sender''s address
Mail.FromName = CSREmail '' Specify sender''s name
Mail.IsHTML = True
Mail.Subject = Reason

Dim mail_body

mail_body = "CSR''s Name : " & CSRName & "<br>" &_
"CSR''s Ext : " & CSRExt & "<br>" &_
"Customer Name : " & CustName & "<br>" &_
"Customer''s Phone Number : " & CustPhone & "<br>" &_
"Customer''s Address : " & CustAddress & "<br>" &_
"City / State / Zip : " & CityStateZip & "<br>" &_
"Ecometry Order # : " & EcomOrder & "<br>" &_
"Customer''s Expected Dollar Amount : " & CustExpect & "<br>" &_
"Gift Card # : " & GCNumber & "<br>" &_
"PIN : " & PIN & "<br>" &_
"Reason : " & Reason & "<br>" &_
"Solution : " & Solution & "<br>" &_
"Credit Card Number : " & CCNumber & "<br>"

mail.body = mail_body & request.servervariables("REMOTE_ADDR")

On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
End Sub
''************************************************* ****************************

''************************************************* ****************************
''* DATABASE APPENDING
*
''************************************************* ****************************
Sub Database()
''create db connection
Set gcredemption = Server.CreateObject("ADODB.Connection")

''open db in a DSN-less method
gcredemption.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
Server.MapPath("/jax/CS/eucs/Online_Forms/Secured_Archives/eucs.mdb")

''correct syntax for INSERT statement "INSERT INTO
<tablename>(<fieldname>) VALUES (<data>)"
stateSQL = "INSERT INTO gcredemption(csr_name, csr_ext, cust_name,
address, city_state_zip, phone_number, ecom_order, expected,
giftcard_number, pin, reason, solution, cc_number) " &_
"VALUES (''" & Replace(CSRName,"''","''''") & "'',''" &
Replace(CSRExt,"''","''''") & "'',''" & Replace(CustName,"''","''''") & "'',''"
&_
Replace(CustAddress,"''","''''") & "'',''" &
Replace(CityStateZip,"''","''''") & "'',''" & Replace(CustPhone,"''","''''") &
"'',''" &_
Replace(EcomOrder,"''","''''") & "'',''" & Replace(CustExpect,"''","''''")
& "'',''" & Replace(GCNumber,"''","''''") & "'',''" &_
Replace(PIN,"''","''''") & "'',''" & Reason & "'',''" & Solution & "'',''" &
CCNumber & "'')"

''display results of statement on screen for testing purposes
Response.Write(stateSQL)

''remind the SQL statement who it works for
gcredemption.Execute(stateSQL)

''smack around the db connection until it lets go
gcredemption.Close

''kill the connection with extreme prejudice
set gcredemption = nothing

End Sub
''************************************************* ****************************

''************************************************* ****************************
''* CONFIRMATION PAGE AFTER ENTERING DATA
*
''************************************************* ****************************
Sub Confirm()
Response.Write "<h2><img border=''0''
src=''../../../images/success.jpg''></h2>"
Response.Write "<p>The following message has been successfully
submitted!</p>"
Response.Write "CSR''s Name : <font color=''#0000FF''>" & CSRName &
"</font><br>"
Response.Write "CSR''s Ext. : <font color=''#0000FF''>" & CSRExt &
"</font><br>"
Response.Write "Customer''s Name : <font color=''#0000FF''>" & CustName
& "</font><br>"
Response.Write "Customer Phone # : <font color=''#0000FF''>" &
CustPhone & "</font><br>"
Response.Write "Customer''s Address : <font color=''#0000FF''>" &
CustAddress & "</font><br>"
Response.Write "City / State / Zip : <font color=''#0000FF''>" &
CityStateZip & "</font><br>"
Response.Write "Ecometry Order # : <font color=''#0000FF''>" &
EcomOrder & "</font><br>"
Response.Write "Customer''s Expected Dollar Amount : <font
color=''#0000FF''>" & CustExpect & "</font><br>"
Response.Write "Gift Card # : <font color=''#0000FF''>" & GCNumber &
"</font><br>"
Response.Write "PIN : <font color=''#0000FF''>" & PIN & "</font><br>"
Response.Write "Reason : <font color=''#0000FF''>" & Reason &
"</font><br>"
Response.Write "Solution : <font color=''#0000FF''>" & Solution &
"</font><br>"
Response.Write "Credit Card # : <font color=''#0000FF''>" & CCNumber &
"<p>&nbsp;</p>"
Response.Write"<p><a href=''../default.asp''>Return to End User
Consumer Service</a></p>"
End Sub
''************************************************* ****************************

Response.Write "<title>Gift Card Redemption</title>"

If Mode <> "Send" Then
Call Form
End If

If Mode = "Send" Then
'' Call Validation
Call Database
Call Mail
End If

''If Validated_Form = True Then
'' Call Mail
'' Call FileAppend
'' Call Database
'' Call Confirm
''End If

%><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->

*****END OF CODE*****


In article <59*************************@posting.google.com> , dmiller23462

@yahoo.com enlightened us with...
In article <59*************************@posting.google.com> , dmiller23462
@yahoo.com enlightened us with...
Hi guys....I have absolutely NO IDEA what I’’m doing with Javascript
but my end result is I need two text boxes to stay hidden until a
particular option is selected....I’’ve cobbled together the JavaScript
in this code from a couple different sites but I’’m not 100% sure what
each line is doing...This is the ASP code that I’’m using for the
page....Take a look at the JavaScript code and please let me know what
each line is doing....I have been successful in hiding the two text
boxes in question (’’ccnumber’’ and ’’expdate’’) but can’’t display them
now....


ASP has no place in the this group. It just takes up space. :)


What matters is the client-side javascript.

The best thing to do in this case is to view the sourc ein your browser and

post it. That way, we see what the browser sees. Since the browser never sees

ASP, it is completely OT here.


That said...

\tResponse.Write "<p><font size=’’1’’>Gift Card Redemption form is to be
used when a customer reports a Gift Card as lost or "
\tResponse.Write " stolen, an order for a new Gift Card was lost in
transit, or the customer requests the balance on a "


You’’re overcomplicating your life. ;)


You can backslash escape newlines so you don’’t have to keep writing

Response.Write over and over and over...


Response.Write "yada yada yada " \

"more yada yada yada " \

"the end."


Well, at least I can in normal VB. Try it.

\tResponse.Write "gift card to be refunded by check.</font></p>"
\tResponse.Write "<form method=’’POST’’ action=’’Gift_Card_Redemption.asp’’
name=’’gcredeem’’ onSubmit=’’validate()’’>"


onSubmit = "return validate()"

There’’s no point to validation in onSubmit unless you do something based on

the return value, really. I assume validate returns true or false...I haven’’t

gotten that far into the code yet.

\tResponse.Write "&nbsp;<div align=’’left’’>"
\tResponse.Write "<table border=’’0’’ cellpadding=’’0’’ width=’’666’’>"


Have you discovered CSS yet?

<script type=’’javascript’’>
type="text/javascript"

//RETURNS THE STYLE OBJECT
function getStyle(name){
\tif (document.getElementById){return
document.getElementById(name).style;}
\telse if (document.all){return document.all[name].style;}
\telse if (document.layers){return document.layers[name];}


You supporting netscape 4?

If not, drop the layers.


You should also provide something to do in the case NONE is true.

}

//HANDLES THE CHANGE IN SELECT BOX
function checkInput(value){
\tif (value==’’credit’’){show(’’ccnumber’’, ’’expdate’’)}
\telse {hide(’’cc’’, ’’exp’’)}


Why is it that the show and the hide have different things in the quotes?

My guess is that your javascript problem is right here.

<tr>
<td width=’’153’’ valign=’’top’’><span id=’’exp’’ style=&q uot;display: none;">
Expiration Date</td>
<td width=’’503’’><span id=’’expdate’’ style="display: none;">
<input type=’’text’’ name=’’expdate’’ id=’’exp’’ size="20"></span>
</span></span>

<%
\tResponse.Write "<td width=’’503’’>&nbsp;"


Again a chain of Response.Write statements that don’’t need to be here.

It makes the code harder to read.

There’’s nothing in this block that prevents it from being pure html code. No

need for ASP here at all.

\tOn Error Resume Next
Hi guys....I have absolutely NO IDEA what I''m doing with Javascript
but my end result is I need two text boxes to stay hidden until a
particular option is selected....I''ve cobbled together the JavaScript
in this code from a couple different sites but I''m not 100% sure what
each line is doing...This is the ASP code that I''m using for the
page....Take a look at the JavaScript code and please let me know what
each line is doing....I have been successful in hiding the two text
boxes in question (''ccnumber'' and ''expdate'') but can''t display them
now....

ASP has no place in the this group. It just takes up space. :)

What matters is the client-side javascript.
The best thing to do in this case is to view the sourc ein your browser and
post it. That way, we see what the browser sees. Since the browser never sees
ASP, it is completely OT here.

That said...
Response.Write "<p><font size=''1''>Gift Card Redemption form is to be
used when a customer reports a Gift Card as lost or "
Response.Write " stolen, an order for a new Gift Card was lost in
transit, or the customer requests the balance on a "
You''re overcomplicating your life. ;)

You can backslash escape newlines so you don''t have to keep writing
Response.Write over and over and over...

Response.Write "yada yada yada " \
"more yada yada yada " \
"the end."

Well, at least I can in normal VB. Try it.
Response.Write "gift card to be refunded by check.</font></p>"
Response.Write "<form method=''POST'' action=''Gift_Card_Redemption.asp''
name=''gcredeem'' onSubmit=''validate()''>"
onSubmit = "return validate()"
There''s no point to validation in onSubmit unless you do something based on
the return value, really. I assume validate returns true or false...I haven''t
gotten that far into the code yet.
Response.Write "&nbsp;<div align=''left''>"
Response.Write "<table border=''0'' cellpadding=''0'' width=''666''>"
Have you discovered CSS yet?

<script type=''javascript''> type="text/javascript"

//RETURNS THE STYLE OBJECT
function getStyle(name){
if (document.getElementById){return
document.getElementById(name).style;}
else if (document.all){return document.all[name].style;}
else if (document.layers){return document.layers[name];}
You supporting netscape 4?
If not, drop the layers.

You should also provide something to do in the case NONE is true.
}

//HANDLES THE CHANGE IN SELECT BOX
function checkInput(value){
if (value==''credit''){show(''ccnumber'', ''expdate'')}
else {hide(''cc'', ''exp'')}
Why is it that the show and the hide have different things in the quotes?
My guess is that your javascript problem is right here.
<tr>
<td width=''153'' valign=''top''><span id=''exp'' style="display: none;">
Expiration Date</td>
<td width=''503''><span id=''expdate'' style="display: none;">
<input type=''text'' name=''expdate'' id=''exp'' size="20"></span>
</span></span>

<%
Response.Write "<td width=''503''>&nbsp;"

Again a chain of Response.Write statements that don''t need to be here.
It makes the code harder to read.
There''s nothing in this block that prevents it from being pure html code. No
need for ASP here at all.

On Error Resume Next




EWWWWW.


Don’’t you have .net or something?

Try/catch is a beautiful thing.


Anyway, if you want further help, post a testable HTML page - not ASP. I

don’’t have ASP here. I can’’t run it. I can’’t do anything with it but look at

it and make fun of you. Copy and paste the source from the browser and we’’ll

see what we can do. :)

(Just kidding about making fun, now, don’’t get all offended or anything.

*LOL*)


HTH

--

--

~kaeli~

Synonym: the word you use in place of a word you can’’t

spell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace



EWWWWW.

Don''t you have .net or something?
Try/catch is a beautiful thing.

Anyway, if you want further help, post a testable HTML page - not ASP. I
don''t have ASP here. I can''t run it. I can''t do anything with it but look at
it and make fun of you. Copy and paste the source from the browser and we''ll
see what we can do. :)
(Just kidding about making fun, now, don''t get all offended or anything.
*LOL*)

HTH
--
--
~kaeli~
Synonym: the word you use in place of a word you can''t
spell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


My deepest apologies for posting ASP code.... :-) The only section of

my form that is in HTML is the following fields....As I mentioned

before, the JavaScript is a copy-n-paste from a couple sites....The

only problem is that I haven’’t been able to figure out exactly what

each line of the script accomplishes.....The bottom line is that when

the option "Credit to CC& QUOT; is selected (via the HTML select), I want to

allow the user to input the CC information (’’ccnumber’’ and ’’expdate’’

HTML text fields) but if the previous two options are chosen

(’’Replacement GC’’ or ’’Check Refund’’) then I don’’t want these two

fields displayed.....Help?!?!?


****START****

<tr><td width=’’153’’ valign=’’top’’>Solution :</td><td width=’’503’’>


<script type=’’javascript’’>


//RETURNS THE STYLE OBJECT

function getStyle(name){

if (document.getElementById){return

document.getElementById(name).style;}

else if (document.all){return document.all[name].style;}

else if (document.layers){return document.layers[name];}

}


//HANDLES THE CHANGE IN SELECT BOX

function checkInput(value){

if (value==’’credit’’){show(’’ccnumber’’, ’’expdate’’)}

else {hide(’’cc’’, ’’exp’’)}

//\telse return;

}


//CHANGES THE DISPLAY PROPERTY OF ELEMENT ’’ID’’ TO BLOCK

function show(id){

var styleObj=getStyle(id);

styleObj.display=’’block’’;

}


//CHANGES THE DISPLAY PROPERTY OF ELEMENT ’’ID’’ TO NONE

function hide(id){

var styleObj=getStyle(id);

styleObj.display=’’none’’;

}

</script>


<select name=’’solution’’ size=’’1’’ value=’’’’

onchange=’’checkInput(value)’’>

<option value=’’none’’>Choose From List</option>

<option value=’’replace’’>Replacement GC</option>

<option value=’’check’’>Check Refund</option>

<option value=’’credit’’>Credit to Credit Card</option>

</select>


<br>

<tr>

<td width=’’153’’ valign=’’top’’><span id=’’cc’’ style="display: none;">

Credit Card Number</td>

<td width=’’503’’><span id=’’ccnumber’’ style="display: none;">

<textarea cols=’’25’’ rows=’’1’’></textarea>

<!--<input type=’’text’’ name=’’ccnumber’’ id=’’cc’’>--></span>

<br>

<tr>

<td width=’’153’’ valign=’’top’’><span id=’’exp’’ style="display: none;">

Expiration Date</td>

<td width=’’503’’><span id=’’expdate’’ style="display: none;">

<input type=’’text’’ name=’’expdate’’ id=’’exp’’></span> </span></span>


<td width=’’503’’>&nbsp;<tr><td width=’’153’’ valign=’’top’’>&nbsp;</td><td

width=’’503’’>&nbsp;</td></tr><tr><td width=’’153’’ valign=’’top’’>&nbsp;

</td><td width=’’503’’><input type=’’submit’’ value=’’Send Message’’

name=’’Send’’></td></tr></table></div><input type=’’hidden’’ name=’’mode’’

value=’’Send’’>

</form><p><a href=’’../default.asp’’>Return to End User Consumer

Service</a></p></td>

</tr>

</table>

*****END****

kaeli <ti******@NOSPAM.comcast.net>在消息新闻中写道:< MP ************************ @ nntp.lucent.com>。 ..
My deepest apologies for posting ASP code.... :-) The only section of
my form that is in HTML is the following fields....As I mentioned
before, the JavaScript is a copy-n-paste from a couple sites....The
only problem is that I haven''t been able to figure out exactly what
each line of the script accomplishes.....The bottom line is that when
the option "Credit to CC" is selected (via the HTML select), I want to
allow the user to input the CC information (''ccnumber'' and ''expdate''
HTML text fields) but if the previous two options are chosen
(''Replacement GC'' or ''Check Refund'') then I don''t want these two
fields displayed.....Help?!?!?

****START****
<tr><td width=''153'' valign=''top''>Solution :</td><td width=''503''>

<script type=''javascript''>

//RETURNS THE STYLE OBJECT
function getStyle(name){
if (document.getElementById){return
document.getElementById(name).style;}
else if (document.all){return document.all[name].style;}
else if (document.layers){return document.layers[name];}
}

//HANDLES THE CHANGE IN SELECT BOX
function checkInput(value){
if (value==''credit''){show(''ccnumber'', ''expdate'')}
else {hide(''cc'', ''exp'')}
// else return;
}

//CHANGES THE DISPLAY PROPERTY OF ELEMENT ''ID'' TO BLOCK
function show(id){
var styleObj=getStyle(id);
styleObj.display=''block'';
}

//CHANGES THE DISPLAY PROPERTY OF ELEMENT ''ID'' TO NONE
function hide(id){
var styleObj=getStyle(id);
styleObj.display=''none'';
}
</script>

<select name=''solution'' size=''1'' value=''''
onchange=''checkInput(value)''>
<option value=''none''>Choose From List</option>
<option value=''replace''>Replacement GC</option>
<option value=''check''>Check Refund</option>
<option value=''credit''>Credit to Credit Card</option>
</select>

<br>
<tr>
<td width=''153'' valign=''top''><span id=''cc'' style="display: none;">
Credit Card Number</td>
<td width=''503''><span id=''ccnumber'' style="display: none;">
<textarea cols=''25'' rows=''1''></textarea>
<!--<input type=''text'' name=''ccnumber'' id=''cc''>--></span>
<br>
<tr>
<td width=''153'' valign=''top''><span id=''exp'' style="display: none;">
Expiration Date</td>
<td width=''503''><span id=''expdate'' style="display: none;">
<input type=''text'' name=''expdate'' id=''exp''></span> </span></span>

<td width=''503''>&nbsp;<tr><td width=''153'' valign=''top''>&nbsp;</td><td
width=''503''>&nbsp;</td></tr><tr><td width=''153'' valign=''top''>&nbsp;
</td><td width=''503''><input type=''submit'' value=''Send Message''
name=''Send''></td></tr></table></div><input type=''hidden'' name=''mode''
value=''Send''>
</form><p><a href=''../default.asp''>Return to End User Consumer
Service</a></p></td>
</tr>
</table>
*****END****
kaeli <ti******@NOSPAM.comcast.net> wrote in message news:<MP************************@nntp.lucent.com>. ..
In article <59*************************@posting.google.com> , dmiller23462
@yahoo.com enlightened us with...
In article <59*************************@posting.google.com> , dmiller23462
@yahoo.com enlightened us with...
Hi guys....I have absolutely NO IDEA what I’’m doing with Javascript
but my end result is I need two text boxes to stay hidden until a
particular option is selected....I’’ve cobbled together the JavaScript
in this code from a couple different sites but I’’m not 100% sure what
each line is doing...This is the ASP code that I’’m using for the
page....Take a look at the JavaScript code and please let me know what
each line is doing....I have been successful in hiding the two text
boxes in question (’’ccnumber’’ and ’’expdate’’) but can’’t display them
now....
Hi guys....I have absolutely NO IDEA what I''m doing with Javascript
but my end result is I need two text boxes to stay hidden until a
particular option is selected....I''ve cobbled together the JavaScript
in this code from a couple different sites but I''m not 100% sure what
each line is doing...This is the ASP code that I''m using for the
page....Take a look at the JavaScript code and please let me know what
each line is doing....I have been successful in hiding the two text
boxes in question (''ccnumber'' and ''expdate'') but can''t display them
now....



ASP has no place in the this group. It just takes up space. :)

What matters is the client-side javascript.
The best thing to do in this case is to view the sourc ein your browser and
post it. That way, we see what the browser sees. Since the browser never sees
ASP, it is completely OT here.

That said...



ASP has no place in the this group. It just takes up space. :)

What matters is the client-side javascript.
The best thing to do in this case is to view the sourc ein your browser and
post it. That way, we see what the browser sees. Since the browser never sees
ASP, it is completely OT here.

That said...

\tResponse.Write "<p><font size=’’1’’>Gift Card Redemption form is to be
used when a customer reports a Gift Card as lost or "
\tResponse.Write " stolen, an order for a new Gift Card was lost in
transit, or the customer requests the balance on a "
Response.Write "<p><font size=''1''>Gift Card Redemption form is to be
used when a customer reports a Gift Card as lost or "
Response.Write " stolen, an order for a new Gift Card was lost in
transit, or the customer requests the balance on a "



You’’re overcomplicating your life. ;)

You can backslash escape newlines so you don’’t have to keep writing
Response.Write over and over and over...

Response.Write "yada yada yada " \
"more yada yada yada " \
"the end."

Well, at least I can in normal VB. Try it.



You''re overcomplicating your life. ;)

You can backslash escape newlines so you don''t have to keep writing
Response.Write over and over and over...

Response.Write "yada yada yada " \
"more yada yada yada " \
"the end."

Well, at least I can in normal VB. Try it.

\tResponse.Write "gift card to be refunded by check.</font></p>"
\tResponse.Write "<form method=’’POST’’ action=’’Gift_Card_Redemption.asp’’
name=’’gcredeem’’ onSubmit=’’validate()’’>"
Response.Write "gift card to be refunded by check.</font></p>"
Response.Write "<form method=''POST'' action=''Gift_Card_Redemption.asp''
name=''gcredeem'' onSubmit=''validate()''>"



onSubmit = "return validate()"
There’’s no point to validation in onSubmit unless you do something based on
the return value, really. I assume validate returns true or false...I haven’’t
gotten that far into the code yet.



onSubmit = "return validate()"
There''s no point to validation in onSubmit unless you do something based on
the return value, really. I assume validate returns true or false...I haven''t
gotten that far into the code yet.

\tResponse.Write "&nbsp;<div align=’’left’’>"
\tResponse.Write "<table border=’’0’’ cellpadding=’’0’’ width=’’666’’>"
Response.Write "&nbsp;<div align=''left''>"
Response.Write "<table border=''0'' cellpadding=''0'' width=''666''>"



Have you discovered CSS yet?



Have you discovered CSS yet?


<script type=’’javascript’’>

<script type=''javascript''>


type="text/javascript"


type="text/javascript"


//RETURNS THE STYLE OBJECT
function getStyle(name){
\tif (document.getElementById){return
document.getElementById(name).style;}
\telse if (document.all){return document.all[name].style;}
\telse if (document.layers){return document.layers[name];}

//RETURNS THE STYLE OBJECT
function getStyle(name){
if (document.getElementById){return
document.getElementById(name).style;}
else if (document.all){return document.all[name].style;}
else if (document.layers){return document.layers[name];}



You supporting netscape 4?
If not, drop the layers.

You should also provide something to do in the case NONE is true.



You supporting netscape 4?
If not, drop the layers.

You should also provide something to do in the case NONE is true.

}

//HANDLES THE CHANGE IN SELECT BOX
function checkInput(value){
\tif (value==’’credit’’){show(’’ccnumber’’, ’’expdate’’)}
\telse {hide(’’cc’’, ’’exp’’)}
}

//HANDLES THE CHANGE IN SELECT BOX
function checkInput(value){
if (value==''credit''){show(''ccnumber'', ''expdate'')}
else {hide(''cc'', ''exp'')}



Why is it that the show and the hide have different things in the quotes?
My guess is that your javascript problem is right here.



Why is it that the show and the hide have different things in the quotes?
My guess is that your javascript problem is right here.

<tr>
<td width=’’153’’ valign=’’top’’><span id=’’exp’’ style="display: none;">
Expiration Date</td>
<td width=’’503’’><span id=’’expdate’’ style="display: none;">
<input type=’’text’’ name=’’expdate’’ id=’’exp’’ size="20"></span>
</span></span>

<%
\tResponse.Write "<td width=’’503’’>&nbsp;"
<tr>
<td width=''153'' valign=''top''><span id=''exp'' style="display: none;">
Expiration Date</td>
<td width=''503''><span id=''expdate'' style="display: none;">
<input type=''text'' name=''expdate'' id=''exp'' size="20"></span>
</span></span>

<%
Response.Write "<td width=''503''>&nbsp;"


Again a chain of Response.Write statements that don’’t need to be here.
It makes the code harder to read.
There’’s nothing in this block that prevents it from being pure html code. No
need for ASP here at all.



Again a chain of Response.Write statements that don''t need to be here.
It makes the code harder to read.
There''s nothing in this block that prevents it from being pure html code. No
need for ASP here at all.


\tOn Error Resume Next

On Error Resume Next



EWWWWW.

Don’’t you have .net or something?
Try/catch is a beautiful thing.

Anyway, if you want further help, post a testable HTML page - not ASP. I
don’’t have ASP here. I can’’t run it. I can’’t do anything with it but look at
it and make fun of you. Copy and paste the source from the browser and we’’ll
see what we can do. :)
(Just kidding about making fun, now, don’’t get all offended or anything.
*LOL*)

HTH
--



EWWWWW.

Don''t you have .net or something?
Try/catch is a beautiful thing.

Anyway, if you want further help, post a testable HTML page - not ASP. I
don''t have ASP here. I can''t run it. I can''t do anything with it but look at
it and make fun of you. Copy and paste the source from the browser and we''ll
see what we can do. :)
(Just kidding about making fun, now, don''t get all offended or anything.
*LOL*)

HTH
--



这篇关于JavaScript - 隐藏/显示文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆