Calling av function when clicking a button

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Calling av function when clicking a button

    Hi!

    I have made a function calles "send()". When I click a button, I want the
    function to be prosessed.
    This is the code that I have made, but it dont work:



    <%function send()

    Value = MsgBox ("Trykk på en knapp...",4,"Trykk en knapp vindu")
    If Value = 6 Then
    MsgBox "You pushed Yes!"
    Else
    MsgBox "You pushed No!"
    End If

    end function%>


    input type="button" value="Utfør" onclick="send()" name="Utfoer"/>



    What is wrong here? Thanks for your help :)
    Regards Øyvind.


    Øyvind Isaksen Guest

  2. Similar Questions and Discussions

    1. Double clicking submit button - duplicates
      Hi there, I have a DW insert record behaviour on a php page. If the user clicks Submit quickly multiple times, I end up with duplicate records. Any...
    2. how to keep people from 'clicking' on my rollover button
      when a client clicks on my rollover button (only intended to show a second image) she gets a PAGE NOT FOUND. This is terrible. HELP. If a...
    3. button does not work upon clicking
      Hi, I have 3 buttons on a asp.net page. They are exactly the same except for the name. Two of the buttons works but the third one does not...
    4. All procedures run when clicking on the refresh button of the explorer
      This is very weried!' All the events of the controls in the form execute when i click on the refresh button of the internet explorer. Any reason...
    5. hourglass when clicking button?
      is there a way to display an hourglass for the client's cursor when clicking a button running server-side code? thanks.
  3. #2

    Default Re: Calling av function when clicking a button

    Hi,

    There's a bit of a mixture of client-side and server-side code here...
    You've posted to an ASP group (which is server-side) - but I'll see
    if I'm on the right lines with what you're trying to do ....

    Any code within <% ... %> markers means it runs server-side (i.e. it
    runs on the web server 'before' the HTML has been written out) and
    anything in the HTML elements - like 'OnClick="send()"' is client-side
    (runs in the browser on the user's machine - after the HTML has been
    written out). Normally, you'd expect to run anything with Popups
    (MsgBox) on the client-side.

    It looks like you need to change your send function to be within a
    client-side <SCRIPT> block and this will all work in the browser
    without going back to the Web Server.

    so ...

    <html>
    <head>

    <script language="vbscript">

    function send()

    Value = MsgBox ("Trykk på en knapp...",4,"Trykk en knapp vindu")
    If Value = 6 Then
    MsgBox "You pushed Yes!"
    Else
    MsgBox "You pushed No!"
    End If

    end function

    </script>

    </head>

    <body>

    <form>
    <input type="button" value="Utfør" onclick="send()" name="Utfoer"/>
    </form>

    </body>
    </html>


    .... should do the trick.

    Just another point. If this is going to run on a browser other than
    Internet Explorer - you'll probably need to rewrite you script into
    JavaScript, as this is more supported 'cross-browser'.

    Hope that helps - and I haven't misunderstood.

    Cheers,

    Matt Simner





    "Øyvind Isaksen" <oyvind@webressurs.no> wrote in message news:<#KGWSPrdDHA.1044@tk2msftngp13.phx.gbl>...
    > Hi!
    >
    > I have made a function calles "send()". When I click a button, I want the
    > function to be prosessed.
    > This is the code that I have made, but it dont work:
    >
    >
    >
    > <%function send()
    >
    > Value = MsgBox ("Trykk på en knapp...",4,"Trykk en knapp vindu")
    > If Value = 6 Then
    > MsgBox "You pushed Yes!"
    > Else
    > MsgBox "You pushed No!"
    > End If
    >
    > end function%>
    >
    >
    > input type="button" value="Utfør" onclick="send()" name="Utfoer"/>
    >
    >
    >
    > What is wrong here? Thanks for your help :)
    > Regards Øyvind.
    Matt Simner Guest

  4. #3

    Default Re: Calling av function when clicking a button

    There are 2 ways you could do it. One is use ASP.NET which support
    object oriented code. The other is to redirect the user to another ASP
    page when the button is clicked. That page can call the function when
    loading.

    Since ASP3.0 is a scripted language you don't have much in the way of
    options.

    hth,
    Andrew

    DEVBuilder.org, [url]http://www.DEVBuilder.org[/url]
    ASP,ASP.NET,VB.NET,PHP,Java,and SQL Support, all in one place.
    Andrew Durstewitz Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139