Click to See Complete Forum and Search --> : running javascript function from asp code


rtatnell
03-30-2003, 02:01 PM
How can I run a javascript function from inside my ASP code?

rtatnell
03-31-2003, 08:42 AM
I have a layer defined using the DIV tag, and I want to hide or show this layer dependant on a database field value.

pyro
03-31-2003, 09:47 AM
Try something along these lines..

<script language="javascript" type="text/javascript">
function showLayer()
var x = <%= ASPVAR %>;
if (x == 1)
{
// code for if ASPVAR equals one (eg. show layer)
}
else
{
// code for if ASPVAR does not equal one (eg. hide layer)
}
NOTE: the ASP code to write the variable to the script could quite possibly be wrong, as I don't know any ASP... ;)

rtatnell
03-31-2003, 10:20 AM
ah, didnt think of doing it that way
cheers!