Forum Moderators: open

Message Too Old, No Replies

if object exist

         

gonny

10:19 pm on Sep 17, 2009 (gmt 0)

10+ Year Member



Hi all!
I'm trying to get a part of url if exist.

pathArray = window.location.pathname.split ( '/');

//See if url ex. domain.com/path1/path2/index.htm has a third slash
if(pathArray[2]){
showslash ='../';
}
else {
showslash ='';
}

var h=""+showslash+"portal/chat/";

Whats wrong :)? I'm not so familiar with js

whoisgregg

3:51 pm on Sep 18, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I typically do a check like this:

if(pathArray[2] != undefined){