[thelist] Brain fart html w/asp Redefined

Rob Smith rob.smith at thermon.com
Thu Apr 11 16:18:01 CDT 2002


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]

It's 4 o'clock in the afternoon and I've been staring at my monitor for
nearly 9 hours now (not just on this problem). BTW, I'm using ASP 2.0 on IIS
4.0 with VBScript 5.0.

While all this sounds fun working between all three languages, I had a
problem that I mistakenly overlooked but not to undermine your advice. All
this is good and I wanted to know it anyway.

I have a form. That forms sends stuff using GET to this form (in email).
This form (in email) needs to be checked if certain selections were made and
then run make decisions from those choices. So basically I have two
querystings running around on the same page. Gotta' eliminate one and use
the other. so...

I stored the previous information into an array so I could keep it so I
could check the new selections with request.form(). Then use both pieces of
information to do something else... awe heck see below.

		    <-----<----
        	    |          |
	  	____|________  |
	  	|   |	      |  |
old.asp 	|   \/      |  |
----->------|-->----->--|-->
query	  	|   |		|
 string 	|   |		|
	  	|  Form.asp | new choices made but needs previous
information too.
	  	-------------
		    |
		    |
		     -------------> do something else (from two different
inputs on one train)

ASCII art is the best I can do at this point. This way is showing potential
for working.


Rob,

> I'm having a brain fart right now. I know how to do this in javascript,
but
> how different is it in ASP with HTML

    Hmm. Do you mean VBScript and HTML? Using ASP on the server side in no
way dictates that you need to use VBScript on the client side. If you _want_
to use VBScript on the client, just remember that only IE 3+ will understand
it.

> <input type="button" name="Ok" value="Ok" onClick(call doit())>

> Is the onClick part right or what do I need to do to call a function when
> the button is clicked without using javascript.

    No, the onclick part is messed up, regardless of the scripting language
used. The mixed case of onClick is okay, but you are missing your "=". Don't
use the outer parens around the whole thing. And you probably don't need the
"call" statement. So:

<input type="button" name="Ok" value="Ok" onclick="doit()">

    You can also leave out the event handler in the input element and write
your script this way, especially if this particular button is the only one
that will execute the code:

<script type="text/vbscript">
  Sub Ok_OnClick
    ' Run some code
  End Sub
</script>

> can javascript call VBScript functions and the other way around?

    Yes.

> Can you use Javascript and VBScript in the same page, sometimes working
> together?

    Yes, depending on what you mean by "working together". Each language
needs to be isolated within its own <script> element, but you can toss
variables and call functions back and forth between the two.
    One critical point: the first script block appearing on the page sets
the default language for the page. Then, any script that appears within
event handlers in the HTML needs to be consistent with that language. For
instance, this will cause an error:

<script type="text/vbscript"></script>
<script type="text/javascript"></script>
<input type="button" onclick="window.open();">

    The semicolon in the onclick event handler is JavaScript and will cause
a parsing error when the page loads. Switching the script blocks or removing
the semicolon will eliminate the error. You can also append the
"javascript:" pseudo-protocol to the statement, e.g.:

onclick="javascript:window.open();"

    But I come back to the question: are you sure that you need to use
VBScript on the client?

James Aylard

--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !



More information about the thelist mailing list