|
-
Jul 22nd, 2005, 03:56 AM
#1
Thread Starter
Junior Member
Function problem
can anyone help me here and tell me why this doesn't work?
<%
sub fnt()
response.redirect("http://www.microsoft.com")
end sub
%>
<button onClick='<%fnt()%>'/>
So when i click the button i should be redirected to microsoft.com?
-
Jul 22nd, 2005, 04:05 AM
#2
Thread Starter
Junior Member
Re: Function problem
I forgot to tell.. It works but it redirects imediatly to microsoft.com when i open the page.
-
Jul 22nd, 2005, 05:36 AM
#3
Re: Function problem
First, there's no such thing as <button>!!
Second, you are placing the "action" of the subroutine fnt (which is server side) in the onclick attribute of button. Which makes as much sense as George Bush giving a state of the union address.
Do this instead:
Code:
<script language="JavaScript">
function fnt(){
document.location.href='http://www.mendhak.com';
}
</script>
<input type="button" value="Click me" onClick="javascript:fnt()"/>
-
Jul 22nd, 2005, 05:59 AM
#4
Thread Starter
Junior Member
-
Jul 23rd, 2005, 02:02 PM
#5
Fanatic Member
Re: Function problem
Hi,
If your doing this in VBscript, which it looks like you are, youll have to check whether the button is pressed or not first, as when the scipt loads, the funciton will return the value of -1 and execute imeediately.
if request.form (buttonname) <> "" then
'redirect coding.
end if
end function
thjis should work...
ta
kai
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|