Results 1 to 4 of 4
  1. #1

    execu. a javascript in asp

    i am trying to run an alarm box (pop up) within an ASP if-else statement.

    ex:
    <%
    if not a=b then
    %>
    <script type="text/javascript">
    alert("I am an alert box!!")
    </script>
    <%
    end if
    %>

    but not working...anyone know how to do?

  2. #2
    Join Date
    Aug 2002
    Location
    Superior, CO, USA
    Posts
    633
    Have you looked at the HTML that gets generated - what does it have in it?
    Need Java help? Want to help people who do? Sit down with a cup of Java at the hotjoe forums.

  3. #3
    it has the script generated no matter what
    <script type="text/javascript">
    alert("I am an alert box!!")
    </script>

    means, the if-else statement puts no effect.

    ps: the script is within <head></head>.

  4. #4
    Join Date
    Mar 2004
    Location
    USA
    Posts
    4,342

    Arrow

    Quote Originally Posted by 0124
    i am trying to run an alarm box (pop up) within an ASP if-else statement.

    ex:
    <%
    if not a=b then
    %>
    <script type="text/javascript">
    alert("I am an alert box!!")
    </script>
    <%
    end if
    %>

    but not working...anyone know how to do?
    Yes, because thats exactly what you are doing, displaying it no matter what..

    Why not print it instead, e.g. for PHP I would do:

    echo '<script>alert("Hiii");</script>';

    Peace,
    Testing 1.. Testing 1..2.. Testing 1..2..3...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •