asp表单问题

发布于 2024-09-09 22:52:36 字数 1187 浏览 2 评论 0原文

我有这个表单

<form action="http://www.mysite.com/asp/formd.asp" method="post" target="_blank">

,所以 asp 如下所示,

它打开一个新窗口,其中 ot 说“发送确定”

我的问题是如何以及在哪里可以控制/定义这个新窗口的样式,即背景字体颜色等 感谢

ASP 代码:

<%@ Language=VBScript %>

<%

Dim txtbody
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")

objCDO.To = "[email protected]"
objCDO.From = "[email protected]"
objCDO.Subject = "* *Formu enviado desde web * *"

txtbody = ""
for a = 1 to Request.Form.Count
 txtbody = txtbody & Request.Form.Key(a) & " = " & Request.Form(a) & chr(10) & chr(13)
next

for a = 1 to Request.QueryString.Count
 txtbody = txtbody & Request.QueryString.Key(a) & " = " & Request.QueryString(a) & chr(10) & chr(13)
next

txtbody = txtbody & "*******-----------------******"

objCDO.Body = txtbody

objCDO.Send

Response.Write "send = Ok"

%>

I have this form

<form action="http://www.mysite.com/asp/formd.asp" method="post" target="_blank">

so the asp looks like below,

it opens a new window where ot says "send ok"

my question is how and where can I contro/define the style of this new window i.e background fonts color etc
thanks

the ASP code:

<%@ Language=VBScript %>

<%

Dim txtbody
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")

objCDO.To = "[email protected]"
objCDO.From = "[email protected]"
objCDO.Subject = "* *Formu enviado desde web * *"

txtbody = ""
for a = 1 to Request.Form.Count
 txtbody = txtbody & Request.Form.Key(a) & " = " & Request.Form(a) & chr(10) & chr(13)
next

for a = 1 to Request.QueryString.Count
 txtbody = txtbody & Request.QueryString.Key(a) & " = " & Request.QueryString(a) & chr(10) & chr(13)
next

txtbody = txtbody & "*******-----------------******"

objCDO.Body = txtbody

objCDO.Send

Response.Write "send = Ok"

%>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

说好的呢 2024-09-16 22:52:36

如果您想要一个更有意义的页面或消息,请考虑将其替换

Response.Write "send = Ok"

为:

Response.Redirect "email-thank-you.htm" 'or .asp, whatever you like.

然后让您的新页面 email-thank-you.htm 尽可能漂亮地装饰和样式。这有助于将电子邮件逻辑包含在一个页面或函数中,并与漂亮的页面分开。如果发生了某些情况,即电子邮件服务器不可用,或者电子邮件地址格式错误/丢失,您可以将其写回原始页面。

If you'd like to have a page or message that's more meaningful, consider replacing this

Response.Write "send = Ok"

with this:

Response.Redirect "email-thank-you.htm" 'or .asp, whatever you like.

Then go make your new page email-thank-you.htm as decorated and styled as nicely as you can. This helps by having your email logic contained in one page or function, and separate from the nice page. If something happened, i.e. the email server was unavailable, or perhaps the email address was malformed/missing, you could write that back to the original page.

浪荡不羁 2024-09-16 22:52:36

如果我正确理解您所做的事情,您实际上应该创建一个名为 emailForm.asp 的静态表单,并使用您想要的样式。让它读取您传递的查询字符串并将值放入字段中。在当前页面上放置链接以弹出此页面。

If I understand what you're doing correctly, you should actually create a static form called emailForm.asp with your desired styling. Have it read the querystring that you are passing and and place the values in the fields. Put on link on your current page in order to pop this page up.

依 靠 2024-09-16 22:52:36

您的最后一行 Response.Write "send = Ok" 将作为格式错误的 html 页面输出。

我建议您按如下方式构建页面:

<%@ Language=VBScript %>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
 <!-- Add header info, including links to style sheets -->
</head>
<body>
<%
'Your CDO code goes here

  objCDO.Send

  if err.number > 0 then
    response.write "<p class='error'>Error: " & err.number & " - " & err.message & "</p>"
  else
    Response.write "<p class='ok'>Sent OK</p>"
  end if
%>
</body>
</html>

这将呈现一个完整的 html 页面,您可以正确设置样式(并且也不会假定电子邮件发送正常!)。

Your final line, Response.Write "send = Ok" is being output as a badly-formed html page.

I'd recommend you structure your page as follows:

<%@ Language=VBScript %>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
 <!-- Add header info, including links to style sheets -->
</head>
<body>
<%
'Your CDO code goes here

  objCDO.Send

  if err.number > 0 then
    response.write "<p class='error'>Error: " & err.number & " - " & err.message & "</p>"
  else
    Response.write "<p class='ok'>Sent OK</p>"
  end if
%>
</body>
</html>

This will render a full html page that you can style properly (and will also no presume that the email sent OK!).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文