我有这个CSS代码:
form
{
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#6EA5FF);
background: -webkit-gradient(linear, bottom, left 175px, from(#CCCCCC), to(#EEEEEE));
background: -moz-linear-gradient(bottom, #CCCCCC, #EEEEEE 175px);
background-color: #E0E0E0;
margin:auto;
position:relative;
width:640px;
height:820px;
font-family: Tahoma, Geneva, sans-serif;
font-size: 14px;
font-style: normal;
line-height: 24px;
font-weight: bold;
color: black;
text-decoration: none;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding:10px;
border: 1px solid #999;
border: inset 1px solid #333;
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
}
对于这种形式:
<form id="form" runat="server">
<h1 align="center">Ticker Tape Updater</h1>
<legend>Message (to be appended to current message)</legend>
每当我单击表单内的 asp 按钮发送电子邮件时,表单就会移动到屏幕左侧,该屏幕原本居中。在我发送电子邮件后,我的 vbscript 中有一些代码调用一个警告框弹出,说明电子邮件已发送。如果我刷新页面,我会收到电子邮件弹出框,并且电子邮件会再次发送,并且表单仍位于页面左侧。如果我单击清除所有文本框并重置所有复选框的页面上的 asp 按钮,则表单将返回到中间。我想因为当我刷新页面并再次收到警报消息并再次发送电子邮件时,代码没有完成运行或其他什么。有任何想法吗?这是我的 vb 代码:
Protected Sub submitBtn_Click(sender As Object, e As System.EventArgs) Handles submitBtn.Click
Dim msg As String = "- " + TextBox1.Text + " -"
If (Checkbox4.Checked = True Or Checkbox5.Checked = True) And (DepartmentIsSelected() = False) Then
Exit Sub
Else
If AtLeastOneIsChecked() = True Then
'Add message to Screen 1
If Checkbox1.Checked Then
UpdateMessage(1, msg)
End If
'Add message to Screen 2
If Checkbox2.Checked Then
UpdateMessage(2, msg)
End If
'Add message to Screen 3
If Checkbox3.Checked Then
UpdateMessage(3, msg)
End If
End If
If (Checkbox4.Checked = True Or Checkbox5.Checked = True) And (DepartmentIsSelected() = True) Then
'Send emails
If Checkbox4.Checked And DepartmentIsSelected() Then
SendMessageToEmailOrText("email", msg)
End If
'Send texts
If Checkbox5.Checked And DepartmentIsSelected() Then
SendMessageToEmailOrText("text", msg)
End If
End If
If AtLeastOneIsChecked() Then
ClearAll()
End If
End If
End Sub
Protected Sub UpdateMessage(ByVal screenNumber As Integer, ByVal message As String)
"code for sub"
End Sub
Protected Sub SendMessageToEmailOrText(ByVal emailOrText As String, ByVal message As String)
'This section grabes the email addresses and text address from the function then send out the emial and text seperately not in the same message.
'grabEmailAddresses()
'grabTextAddresses()
Dim subject As String = "Broadcast Alert"
Dim mClient = New SmtpClient("smtp.aaicorp.com")
Dim addresses As String
Dim addresses1 As String
If emailOrText = "email" Then
'*******************************************************************************************************************
'This section addes Bcc to the To: line so there is no one listed in this line and the people do not see all the emil addresses
'create the mail message
Dim mail As New MailMessage()
'set the addresses
'to specify a friendly 'from' name, we use a different ctor
mail.From = New MailAddress("flims@aai.textron.com", "FLIMS Site")
'since the To,Cc, and Bcc accept addresses, we can use the same technique as the From address
'since the To, Cc, and Bcc properties are collections, to add multiple addreses, we simply call .Add(...) multple times
'addresses = "spowers@aai.textron.com"
addresses &= grabEmailAddresses() ' addresses is dimensioned before the if statement The grabEmailAddressed is a function to get the email addresses
Dim SendBcc As String = (addresses)
mail.Bcc.Add(SendBcc)
'Response.Write("<script>alert('" & addresses & "')</script>")
'Response.Write("<script>alert('" & SendBcc & "')</script>")
'set the content
mail.Subject = "Broadcast Alert"
'set the body
mail.Body = message
'Send the email
'mClient.Send(mail) 'mClient is dimensioned before the if statement
Response.Write("<script>alert('Email Messages Sent')</script>")
System.Threading.Thread.Sleep(4000) ' This is used to have a pause to send out the first message if you send email and text
'*****************************************************************************************************************************
'If you want to see all of the sender do this instead uncomment this section and commnet out the above
''Response.Write("<script>alert('" & addresses & "')</script>")
'Dim m = New MailMessage("flims@aai.textron.com", addresses, subject, message)
'mClient.Send(m)
'System.Threading.Thread.Sleep(4000) ' This is used to have a pause to send out the first message if you send email and text
Else
addresses1 &= grabTextAddresses() ' addresses is dimensioned before the if statement The grabTextAddressed is a function to get the text phone numbers
'Response.Write("<script>alert('" & addresses1 & "')</script>")
'Response.Write("<script>alert('" & message & "')</script>")
Dim m = New MailMessage("flims@aai.textron.com", addresses1, subject, message)
'mClient.Send(m) ' mClient is dimensioned befor the if statement and "m" is dimension above
Response.Write("<script>alert('Text Messages Sent')</script>")
End If
End Sub
Protected Function grabEmailAddresses() As String
"code for function"
End Function
Protected Function grabTextAddresses() As String
"code for function"
End Function
我把所有相关代码都放在这里,以防你想看,我知道有很多。首先单击按钮,然后运行所有后续功能。现在电子邮件/文本发送 (mClient.Send()) 被注释掉以进行测试。 欢迎就我的问题提出任何意见,谢谢。
最佳答案
我仍然不知道为什么这会将表单向左推,但我将位置更改为绝对 position:absolute;
并执行了 left:25%;
这使它居中。所以这是一个修复,而不是我正在寻找的那个。
关于asp.net - 单击 asp 按钮发送电子邮件后,我的表单移动到页面左侧。不应该发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14569581/