473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP Script Opens New Window!

I am quite new to ASP and trying to find my feet!

I've cobbled together some code to email some form data which works
fine, but when I try to write a success message back to the browser,
or use response.redirect, my browser opens a new window instead of
writing to the current window.

Is there something I can do to stop this? My code is pasted below.

Many thanks, Robert.
MAILFORM.HTM

<form method="POST" action="contactus.asp">
<table border="0" width="100%">
<tr>
<td width="24%">Your Name</td>
<td width="42%"><input type="text" name="Name" size="37"></td>
</tr>
<tr>
<td width="66%" valign="top" colspan="2">Message<br>
<textarea rows="4" name="Message" cols="52"></textarea></td>
</tr>
</table>
<table border="0" width="40%">
<tr>
<td width="33%" align="center"><input type="submit"
value="Send" name="B1"></td>
<td width="33%" align="center"><input type="reset"
value="Reset" name="B2"></td>
<td width="34%" align="center"><input type="button"
value="Cancel" name="B3" onclick='self.close()'></td>
</tr>
</table>
</form>

CONTACTUS.ASP

<%
smtp_server_address = "localhost"
on error resume next
response.buffer = true
Set Jmail = Server.CreateOBject( "JMail.Message" )
Jmail.Logging = true
Jmail.Silent = true
JMail.From = "C&NEE_Contact_Us"
Jmail.AddRecipient "ma**@mail.com"
JMail.Subject = "Information Request"
FOR EACH el IN Request.Form
body = body & el & ": " & Request.form(el) & vbcrlf
NEXT
JMail.Body = Body
JMail.Priority = 1
if not Jmail.Send(smtp_server_address) then
' There was an error - print the error log
Response.write ("Error:<br>" & Jmail.log)
else
' The message has been sent - redirect to confirmation page
Set JMail = Nothing
response.write ("<script>document.write('Your message has been
sent');</script>")
end if
Set JMail = Nothing
%>
Jul 19 '05 #1
1 1289
why are you using a Response.Write to write a <script> with document.write?
Why not just use the Response.Write ?
Your problem isn't the Response.Write by the way, it's the client-side
<script> tag that's opening the new window

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Robert Atkinson" <ra*******@tbs-ltd.co.uk> wrote in message
news:ee**************************@posting.google.c om...
I am quite new to ASP and trying to find my feet!

I've cobbled together some code to email some form data which works
fine, but when I try to write a success message back to the browser,
or use response.redirect, my browser opens a new window instead of
writing to the current window.

Is there something I can do to stop this? My code is pasted below.

Many thanks, Robert.
MAILFORM.HTM

<form method="POST" action="contactus.asp">
<table border="0" width="100%">
<tr>
<td width="24%">Your Name</td>
<td width="42%"><input type="text" name="Name" size="37"></td>
</tr>
<tr>
<td width="66%" valign="top" colspan="2">Message<br>
<textarea rows="4" name="Message" cols="52"></textarea></td>
</tr>
</table>
<table border="0" width="40%">
<tr>
<td width="33%" align="center"><input type="submit"
value="Send" name="B1"></td>
<td width="33%" align="center"><input type="reset"
value="Reset" name="B2"></td>
<td width="34%" align="center"><input type="button"
value="Cancel" name="B3" onclick='self.close()'></td>
</tr>
</table>
</form>

CONTACTUS.ASP

<%
smtp_server_address = "localhost"
on error resume next
response.buffer = true
Set Jmail = Server.CreateOBject( "JMail.Message" )
Jmail.Logging = true
Jmail.Silent = true
JMail.From = "C&NEE_Contact_Us"
Jmail.AddRecipient "ma**@mail.com"
JMail.Subject = "Information Request"
FOR EACH el IN Request.Form
body = body & el & ": " & Request.form(el) & vbcrlf
NEXT
JMail.Body = Body
JMail.Priority = 1
if not Jmail.Send(smtp_server_address) then
' There was an error - print the error log
Response.write ("Error:<br>" & Jmail.log)
else
' The message has been sent - redirect to confirmation page
Set JMail = Nothing
response.write ("<script>document.write('Your message has been
sent');</script>")
end if
Set JMail = Nothing
%>

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Warren | last post by:
Greetings and thanks for helping! my goal is that when someone accesses www.whatever.com, that a SIZED pop-up window OPENS, AND the PARENT window closes. Here is what I have: ****START...
2
by: Dennis | last post by:
This may be easy for most but I can't get this thing to work. I believe I followed all the instructions but when I click on the link no window opens just the default IE page cannot display. Here is...
9
by: Flynn | last post by:
My understanding of javascript is very limited. Could some one help me out. I found this code for an image gallery viewer. It works fine on my site, but I'd like to modify it so that the mainpic...
1
by: William Starr Moake | last post by:
Another problem with the browser-based WYSIWYG editor I'm trying to assemble using IE's design mode. This opens the selected page in the editor iframe named iView: <select name="template"...
2
by: livin | last post by:
I'm hoping someone knows of an example script I can see to help me build mine. I'm looking for an easy way to automate the below web site browsing and pull the data I'm searching for. Here's...
3
by: IntraRELY | last post by:
Hello, I am having an issue with this java code for a pop-up. window.open('clientsCreate.aspx',null,','_blank,height=350,width=750,menubar =no,status=no,toolbar=no') I need the ability to...
1
by: Jon | last post by:
I need to open a new window from client-side JavaScript, and pass a querystring parameter value to the new window. The page that opens in the new window has code-behind logic that requires the...
1
by: TPK | last post by:
Here is what I want to do with javascript. On a page with text place a javascript link that: 1) When a user clicks the link (onClick) a new browser window opens (the easy part) NewWindow =...
2
by: peteinglastonbury | last post by:
I'd be most grateful if someone would help me. I hope I'm in the right forum (apologies if not) - I'm not sure whether my problem is CGI or Javascript related. I found a script called...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.