Forum Moderators: open

Message Too Old, No Replies

Mixing code types javascript & vbscript

Sharing script codes in the same asp file?

         

Milea

4:57 am on Jan 11, 2004 (gmt 0)

10+ Year Member



I've bitten off more then I can chew. I have a collection of works, one, an .asp file professionally done for our company, and several example scripts trying to acheive the final goal. I need for the asp file to allow a choice of sending a message as is, attaching a file and then sending, or canceling entirely. It works if I just let it send without allowing the choices I mentioned, but if I add the buttons, not even the simple send works anymore. The Buttons are using javascript, while the majority of the page is done in vbscript. Is it possible to use the variables defined in the vbscript, in the javascript? I think that's where its going heywire. Any suggestions, here's the piece I'm working with...

(tmpMail was defined previoiously by the vbscript and is text containing form results.)

<% =tmpMail %>
</pre>
<div align="center">
<pre>
<form name="form1" method="post" action="">
<INPUT type="submit" Value="Send the Message" onClick="SendIt()"><input type="submit" value="Attach a Print & Send" name="AttachIt" onClick="AttachIt()"><input type="submit" value="Cancel" name="CancelIt" onClick="CancelIt()">
</form>
</pre>
</div>
</blockquote>
</blockquote>
<% LANGUAGE="VBSCRIPT" %>
<%'<script language=VBscript >

function SendIt()
'Here is where the mailer.send thing has to happen -->
set Mailer.Body = tmpMail
document.form1.action = "Mailer.Send"
response.redirect("http://wwWebmasterWorldebpage.com")
end function

function AttachIt()
document.Form1.action = "uploader.asp"
document.Form1.target = "_blank"
document.Form1.submit()
end function

function CancelIt()
document.Form1.action = "self.close()"
end function

%>

Any suggestions you can give would be appreciated.
Thanks much :)

korkus2000

2:03 am on Jan 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld Milea,

So you are trying to use client-side javascript to call server-side vbscript, or are they both server-side?

Milea

4:52 am on Jan 17, 2004 (gmt 0)

10+ Year Member



Thanks for the welcome Korkus. I'm 98% sure the vbscript is server side, as I cannot test it without uploading to the server and testing there. I'm not sure what the difference is in javascript when run from server or client sides.
I've read a bit more and dug a bit deeper, and made a few changes to the code. Someone suggested a simple 'attach a file?' radio button or check box on the form, would be simpler then all the hopping around on submit.asp. I'll leave another note with the changes if you'd like to take a look and help out.

Thanks again,

Milea