T
Thomas Allen
I was writing a little script today that would add a given class to
anchors that linked to the current page. It does this by checking the
last element of window.location split by '/' (of course this would
typically be accomplished by a server-side language, but some
designers I work with have to build Dreamweaver templates in straight
HTML).
I cast the string for splitting like so because, well, it works:
urlTokens = (window.location + '').split('/');
Is there a more elegant way to do this? Or is this the standard way to
cast objects like window.location as a string?
Thomas
anchors that linked to the current page. It does this by checking the
last element of window.location split by '/' (of course this would
typically be accomplished by a server-side language, but some
designers I work with have to build Dreamweaver templates in straight
HTML).
I cast the string for splitting like so because, well, it works:
urlTokens = (window.location + '').split('/');
Is there a more elegant way to do this? Or is this the standard way to
cast objects like window.location as a string?
Thomas