Motabobo
06-18-2003, 08:07 AM
Hi !
I'm a little bit confused as which use...if/then/else or if/else if.
Could someone tell me if there is a more efficient way to organize this code ? :
if MyArray2(0) = "MOZILLA" then
if Instr(ua, "MSIE") then
MyArray5 = Split(varleft4, " ")
varleft5 = MyArray5(1)
msie = left(varleft5,1)
os = MyArray4(2)
if msie < 4 then
Response.Redirect("error.asp")
end if
elseif Instr(ua, "NETSCAPE") then
os = MyArray4(2)
MyArray5 = Split(varight3,"/")
varight5 = MyArray5(2)
ns = Left(varight5,1)
elseif Instr(ua, "OPERA") then
if Instr(ua, "MSIE") then
MyArray5 = Split(varleft4, " ")
varleft5 = MyArray5(1)
msie = left(varleft5,1)
os = MyArray4(2)
if msie < 5 then
Response.Redirect("error.asp")
end if
else
if mozilla < 5 then
os = MyArray4(0)
Response.Redirect("error.asp")
end if
end if
else
if mozilla < 5 then
Response.Redirect("error.asp")
end if
end if
elseif MyArray2(0) = "OPERA" then
if mozilla < 6 then
os = MyArray4(0)
Response.Redirect("error.asp")
end if
else
Response.Redirect("error.asp")
end if
Thanks !
I'm a little bit confused as which use...if/then/else or if/else if.
Could someone tell me if there is a more efficient way to organize this code ? :
if MyArray2(0) = "MOZILLA" then
if Instr(ua, "MSIE") then
MyArray5 = Split(varleft4, " ")
varleft5 = MyArray5(1)
msie = left(varleft5,1)
os = MyArray4(2)
if msie < 4 then
Response.Redirect("error.asp")
end if
elseif Instr(ua, "NETSCAPE") then
os = MyArray4(2)
MyArray5 = Split(varight3,"/")
varight5 = MyArray5(2)
ns = Left(varight5,1)
elseif Instr(ua, "OPERA") then
if Instr(ua, "MSIE") then
MyArray5 = Split(varleft4, " ")
varleft5 = MyArray5(1)
msie = left(varleft5,1)
os = MyArray4(2)
if msie < 5 then
Response.Redirect("error.asp")
end if
else
if mozilla < 5 then
os = MyArray4(0)
Response.Redirect("error.asp")
end if
end if
else
if mozilla < 5 then
Response.Redirect("error.asp")
end if
end if
elseif MyArray2(0) = "OPERA" then
if mozilla < 6 then
os = MyArray4(0)
Response.Redirect("error.asp")
end if
else
Response.Redirect("error.asp")
end if
Thanks !