OT: Javascript for an ASP guy?

B

Byron

Hey,

I'm pretty good with ASP but Javascript has always confused me so I tend
to use pre-built stuff that I can just plug-in and only tweak if
absolutely necessary.

I'm working on something now that needs to client side dynamism and I
know how I'd do it with with ASP, but I'm sure if Javascript can do
this, or where to look.

Can you, with Javascript, set a variable to a specific value on an
onClick action, and have an if...then in another spot on the page check
the value of that variable and if it meets the right condition toggle
between images?

Seems like you should be able to, but I'm often wrong.
 
M

MarkP

Yes you can. Make sure that the variable is declared in the HEAD section (in
script tags of course), that way it acts like a local variable (global to the
file).

You can then reference that variable elsewhere.
 
B

Byron

Yes you can. Make sure that the variable is declared in the HEAD section (in
script tags of course), that way it acts like a local variable (global to the
file).

You can then reference that variable elsewhere.

Is this considered "Setting a cookie?" That's what I find tutorials on
when I google it.
 
E

Evertjan.

Byron wrote on 02 mrt 2005 in microsoft.public.inetserver.asp.general:
I'm pretty good with ASP but Javascript has always confused me so I tend
to use pre-built stuff that I can just plug-in and only tweak if
absolutely necessary.

I'm working on something now that needs to client side dynamism and I
know how I'd do it with with ASP, but I'm sure if Javascript can do
this, or where to look.

<script language=javascript runat=server>
response.write('Do you think Javascript means clientside');
response.write(' and so is off topic in asp?<br><br>');
response.write('Do you think ASP-guy equals vbscript-guy?');
</script>

if your answer is yes then
please reconsider
end if
 
B

Byron

Byron wrote on 02 mrt 2005 in microsoft.public.inetserver.asp.general:


<script language=javascript runat=server>
response.write('Do you think Javascript means clientside');
response.write(' and so is off topic in asp?<br><br>');
response.write('Do you think ASP-guy equals vbscript-guy?');
</script>

if your answer is yes then
please reconsider
end if

How clever. I said it was off topic. Thanks.
 
E

Evertjan.

Byron wrote on 02 mrt 2005 in microsoft.public.inetserver.asp.general:
How clever. I said it was off topic. Thanks.

Cleverness aside, if that means "yes", then you clearly don't know that
many ASP-guys code preferably in serverside javascript/jscript.

But why, if I may ask, do you ask a clearly clientside javascript question
as OT in this ASP NG and not in one of the javascript or jscript NGs.

Is that because you are an ASP-guy? That wouldn't sound like a valid
reason.
 
B

Bob Barrows [MVP]

While it is preferable to declare all global variables in a single location.
it is not necessary. The only requirement is that they be declared (inside
of a script block) outside of a function.
<head></head>
<body>
<script>
var globvar = 25
.....


globvar can be accessed by other scripts in this page.

Is this considered "Setting a cookie?" That's what I find tutorials on
when I google it.

No. That is much different. This is called "setting a variable", i.e.,
setting aside a location in memory to contain a value that can be referenced
later by code running in the same scope. Cookies are written to the client's
disk, and therefore can be referenced by more than one page. Variables are
in memory, and are destroyed when they go out of scope.

Byron, client-side questions (whether vbscript or javascript) should be
posted in one of the .scripting groups, either .scripting.jscript, or
..scripting.vbscript if you want an IE-only solution.

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top