[thelist] window.nav?

Goldilox Goldilox at teachnet.edb.utexas.edu
Tue Oct 30 14:47:46 CST 2001


I found a piece of JavaScript code:
someLoc = window;
someLoc.nav = nav = window;

and I'm trying to understand what it does.
Here is my page:
<html>
<head>
<title></title>
<script>
<!--
someLoc = window;
someLoc.nav = nav = window;
//-->
</script>
</head>
<body>
Something.
</body>
</html>
If I do this:
someLoc = window;
someLoc.location = location = window;
someLoc="http://www.yahoo.com/";

The URL location stays the same, but the page disappears (and becomes a "page
not found" error). Almost as if a frame had been created within the page, but
the frame cannot find its content.
but:

If I do:
someLoc = window;
someLoc.alert = alert = window;
someLoc("Message");

I get the error "Member not found"; Which means there is an object within an
object, right? I thought alert was a method; can a method be an object?

But if I create a div called nav and a class called nav, someLoc doesn't effect
them at all. 

But:
someLoc = window;
someLoc.nav = nav = window;
someLoc.document.all['nav'].style.color="red";

works as if the 'nav' in 'someLoc.nav' was never there. Yet if my page is a
frame named 'nav', the code won't designate the page named 'nav' as the target
of the code. Is this piece of code I found just obfuscated code?
Can someone help my feeble mind here?

Derf





More information about the thelist mailing list