Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > OT: Javascript for an ASP guy?

Reply
Thread Tools

OT: Javascript for an ASP guy?

 
 
Byron
Guest
Posts: n/a
 
      03-02-2005
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.
 
Reply With Quote
 
 
 
 
MarkP
Guest
Posts: n/a
 
      03-02-2005
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.
 
Reply With Quote
 
 
 
 
Byron
Guest
Posts: n/a
 
      03-02-2005
In article <(E-Mail Removed)>,
http://www.velocityreviews.com/forums/(E-Mail Removed) says...
> 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.
 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      03-02-2005
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

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
Byron
Guest
Posts: n/a
 
      03-02-2005
In article <Xns960D5FD9D4881eejj99@194.109.133.29>,
(E-Mail Removed) says...
> 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
>
>


How clever. I said it was off topic. Thanks.
 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      03-02-2005
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.


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.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      03-02-2005
Byron wrote:
> In article <(E-Mail Removed)>,
> (E-Mail Removed) says...
>> 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).


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.


>>
>> You can then reference that variable elsewhere.
>>

>
> 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
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript or not JavaScript Mark Rae ASP .Net 36 09-09-2006 01:12 PM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
Javascript -> Applet: variable reset after method call from javascript?! mcdeveloper Java 1 06-13-2006 08:34 AM
asp.net - javascript form values interaction can asp.net read and write to nonasp forms? David Virgil Hobbs ASP .Net 0 01-06-2004 07:09 AM
ASP JavaScript versus ASP VBScript John Davis ASP General 5 09-07-2003 12:42 AM



Advertisments