
using vbscript in an asp file
Hello Rahul,
I took some of the code you provided and included it in this example. This
example is pretty straight forward and simple but you can see how easily
you can expand on it.
===============
<form id="frmTest" name="frmTest" method="post" action=""
onSubmit="returnValidateDate()">
<table border="0" align="left" cellspacing="0" cellpadding="0">
<tr>
<td width="35%"><b>Enter Date (MM/DD/CCYY):</b></td>
<td width="25%"><input type="text" name="txtDate" size="20"></td>
<td width="40%">
<input type="button" value="Get Julian Date" name="btnJDate">
</td>
</tr>
</table>
</form>
<script language=vbscript>
sub btnJDate_OnClick
dim getDate
dim X
getDate = frmTest.txtDate.value
'You can do some formatting here if you'd like.
'For example I have a COM object that contains a
'format function like the one VB includes
strMessage = SampleFormattingFunction(getDate)
msgbox strMessage
end sub
function SampleFormattingFunction(strParam1)
SampleFormattingFunction = " * " & strParam1 & " * "
end function
</script>
===============
I hope this helps you. If you have anymore questions just reply to this
posting. I'll be checking periodically to see if you had anymore questions
related to this posting.
--------------------
| Subject: using vbscript in an asp file
| Date: Thu, 31 Jan 2002 08:04:51 -0500
| Lines: 46
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
| Newsgroups: microsoft.public.scripting.vbscript
| NNTP-Posting-Host: port147.net109.bignet.net 206.67.109.147
| Path: cpmsftngxa07!tkmsftngxs02!tkmsftngxs01!tkmsftngp01!tkmsftngp07
| Xref: cpmsftngxa07 microsoft.public.scripting.vbscript:90911
| X-Tomcat-NG: microsoft.public.scripting.vbscript
|
| I am sort of new to using vbscript client side scripting.
|
| I have an asp file in which I have a form. In the form there is a text box
| and a submit button. WHen I input the value in the text box and hit the
| submit button - I want to be able to display the contents of the text box
| via a msgbox on to the screen. I already have the code in place but as
long
| as I do response.write the code works fine. If I do a msgbox the code
| doesnot work. The logic is below
|
| <form method="post" action="post to self" onSubmit="return
ValidateDate():">
| <table border="0" align="left" cellspacing="0" cellpadding="0">
| <tr>
| <td width="35%"><b>Enter Date (MM/DD/CCYY):</b></td>
| <td width="25%"><input type="text" name="txtDate" size="20"></td>
| <td width="40%">
| <input type="button" value="Get Julian Date" name="btnJDate">
| </td>
| </tr>
| </table>
| </form>
| <!-- #include file="getJDate.vbs" -->
|
| In this vbs file, I have
| sub btnJDate_Click()
| DIM getDate,X
| MM/DD/CCYY","Julian Date",Y,5000)
| if request.form("txtDate") <> "" then
| getDate = request.form("txtDate")
| X = ToJulian(getDate)
| strMessage = "the date is " & x
| 'Response.write "<B>The input date is " & "<font color='red'>" &
| request.form("txtDate") & "</font></b> "
| 'Response.write "<B>The date is " & "<font color='red'>" & X &
"</font></b>"
| msgbox(strMessage) ----- this is how I want to display but this doesnot
work
| else
| getDate = ""
| end if
| end sub
|
| Can anyone tell me how I can get the msgbox to work without using
| Javascripts.
|
|
| Thanks
|
|
|