Ask a Question related to ASP, Design and Development.
-
Øyvind Isaksen #1
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
-
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... -
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... -
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... -
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... -
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. -
Matt Simner #2
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
-
Andrew Durstewitz #3
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



Reply With Quote

