PDA

View Full Version : Hiding onClick trouble


Crash1hd
05-15-2003, 08:39 AM
Here is the code question to follow!

<%
DIM SQL, HRS
SQL = "Select userid, UserName From members Order By userid"
Set HRS = Conn.Execute(SQL)
do until HRS.EOF
IF HRS.fields("userid") = Session("userid") Then
If Session("allow") = "Lok" Then
response.write"<P align=""center""><a href=/include/utility.asp?method=abandon onClick=location.reload()>" & HRS.fields("username") & " You are curently logged in click here to log out </a></p>"
response.write"<Div style='position:absolute; top:0; left:0%; z-index: 1'><font color=red>" & Session("Clearance") & "</font></div>"
End If
End If
HRS.movenext
Loop
CleanUp2(HRS)
%>

Ok the area marked in red onClick=location.reload is needed for mozzila or a getElementbyid and helps stop the back click on a members only page! but as you may have already guessed if you click on the link in IE it runs the onClick before the method part and you have to click it 2 times to work? so I need a way of hiding that code from ie but allowing mozzila to see it? Ok I am useing IE and W3 for my references of browser check for example

IF(IE){Blah}
IF(W3){Blah}

I am just not sure how to put the script inside asp code as above

Crash1hd
05-16-2003, 06:58 AM
Ok I figured it out lol! I think my brain was on lunch earlier :)

function w3backblock() {
if(w3) {location.reload();}
else {}
}

is all I had to add then put the w3backblock() in the onClick inside the code!

I feel so silly! :)

But if anyone is wondering how to stop someone from back clicking on a page that has membership restrictions the above is how you make it work in mozzila cause errors in IE not sure about netscape! doesnt help with Opera though still cant figure that one out