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?
Printable View
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?
I forgot to tell.. It works but it redirects imediatly to microsoft.com when i open the page.
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()"/>
ok tnx a lot
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