Is it possible to have a javascript function which has a lot of code inbetween { and } , a lot of which is not JavaScript. What I have is a JavaScript which will direct the user to another site if their IP matches a given address. If it doesn't match the address then the page is displayed normally.

The code was going to run something like :
if IP = redirect.

If the IP didn't match then the page would be loaded as normal . However when the IP does match, the page sometimes shows, just for the few split seconds before it redirects.

What i'd like to do (if possible) is have something like (this is pseudocode)

<Script Language=Javascript)
get IP address
{ //start of else statment

Normal page code will be displayed eg forms.

<script language=JavaScript>
} //end of else statement

Would this scenario work?