Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDONTS and JavaScript

Status
Not open for further replies.

LaPluma

Programmer
Feb 3, 2002
139
DE
Hello

I have a Web site with a simple form on it. This form uses the following VBScript(ASP)CDONTS code:

<%
if (cStr(Request(&quot;Submit&quot;)) <> &quot;&quot;) Then
dim MailObj
set MailObj = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
MailObj.From = Request.Form(&quot;name&quot;)
MailObj.To = &quot;info@grafik1.net&quot;
MailObj.Subject = &quot;Web site quote&quot;
MailObj.Body = &quot;Email was sent by: &quot; & Request.Form(&quot;name&quot;) & vbcrlf & vbcrlf&_
&quot;his/her email address is:&quot; & vbcrlf&_
Request.Form(&quot;email&quot;)
MailObj.Send()
set MailObj = nothing
Response.Redirect(&quot;welcome1.asp&quot;)
End If
%>

When the 'submit' button is clicked, the idea is that welcome1.asp (please see the reference to it in the code above) appears as a centred pop-up window to inform the visitor that his e.mail message has been received.

The problem I am having is that while the above code works, the welcome1.asp page appears as a full Web page after the 'submit' button is clicked, and not as a pop-up.

At the moment I have something like:

onClick=&quot;document.welcome.submit();

where &quot;welcome&quot; is the name of the form and, as I say, this redirects the visitor to welcome1.asp when the user clicks on the 'submit' button. But how to make welcome1.asp a centred pop-up?

Many thanks

LaPluma
 
one solution would be to add to the body tag in the welcome1.asp this line
onload=window.resizeTo(400,400)

this will resize the window on loading to 400 by 400 A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
hmm, still wouldn't open in a new window.
You'll have to use Javascript I think but write it from within your asp code.
Instead of response.redirect try something like this.
Code:
Response.Write(&quot;<script language='javascript'>window.open('welcome1.asp','windowName','')</script>&quot;);

Hopefully that works, let us know.
p.s. That's all one line, not separate.


Hope I helped / Thanks for helping
if ((x<10&&y<10) &&(((parseInt(x.toString()+y.toString())-x-y)%9)!=0)){ alert(&quot;I'm a monkey's uncle&quot;); }
 
Hello to you both

Many thanks for your suggestions.

Leaving this intact:

<%
if (cStr(Request(&quot;Submit&quot;)) <> &quot;&quot;) Then
dim MailObj
set MailObj = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
MailObj.From = Request.Form(&quot;name&quot;)
MailObj.To = &quot;info@grafik1.net&quot;
MailObj.Subject = &quot;Web site quote&quot;
MailObj.Body = &quot;Email was sent by: &quot; & Request.Form(&quot;name&quot;) & vbcrlf & vbcrlf&_
&quot;his/her email address is:&quot; & vbcrlf&_
Request.Form(&quot;email&quot;)
MailObj.Send()
set MailObj = nothing
Response.Redirect(&quot;welcome1.asp&quot;)
End If
%>


and adding onpnt's

<body onload=window.resizeTo(400,400) bgcolor=&quot;#FF9900&quot;>

gave me the desired effect - many thanks.

I did try

Response.Write(&quot;<script language='javascript'>window.open('welcome1.asp','windowName','')</script>&quot;);

as you suggested HellTel, but I got an &quot;Expected end statement error&quot;.

I'll have a play around with it to see why that should be and let you know.

Many thanks agaian to you both.

LaPluma
 
I'm sure I've done that before, not that you need it anyway by the sound of it.
Maybe it's the ; on the end.
Or, if you retyped it, the '' in the window open command is two of ' not a &quot;
But who cares?
Although, does welcome1.asp open in a new window as a popup with response.redirect? Hope I helped / Thanks for helping
if ((x<10&&y<10) &&(((parseInt(x.toString()+y.toString())-x-y)%9)!=0)){ alert(&quot;I'm a monkey's uncle&quot;); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top