Don't understand how to change or use this java script

1 replies
I am using a template I got from someone else. I find it has some java script I don't
think is necessary.

I don't know much about this so will explain what I see.

I can understand the scrollbar, but It looks to do something with cookie stuffing or placing some kind of cookie as well... Would you explain it to me and what I can do. When I try to remove it in my web editor, it just comes right back.

<script language="JavaScript">
<!--
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
toolbar_str = toolbar ? 'yes' : 'no';
menubar_str = menubar ? 'yes' : 'no';
statusbar_str = statusbar ? 'yes' : 'no';
scrollbar_str = scrollbar ? 'yes' : 'no';
resizable_str = resizable ? 'yes' : 'no';

cookie_str = document.cookie;
cookie_str.toString();

pos_start = cookie_str.indexOf(name);
pos_end = cookie_str.indexOf('=', pos_start);

cookie_name = cookie_str.substring(pos_start, pos_end);

pos_start = cookie_str.indexOf(name);
pos_start = cookie_str.indexOf('=', pos_start);
pos_end = cookie_str.indexOf(';', pos_start);

if (pos_end <= 0) pos_end = cookie_str.length;
cookie_val = cookie_str.substring(pos_start + 1, pos_end);
if (cookie_name == name && cookie_val == "done")
return;

window.open(url, name, 'left='+left+',top='+top+',width='+width+',height= '+height+',toolbar='+toolbar_str+',menubar='+menub ar_str+',status='+statusbar_str+',scrollbars='+scr ollbar_str+',resizable='+resizable_str);
}

// -->
</script>

Thanks.

Jeannie
#change #java #script #understand
  • Profile picture of the author mywebwork
    It seems to be opening a new window (you provide the position, size and parameters) and using a cookie to retain an number of variables that represent "positions".

    As for what it's used for I don't have a clue - I'd need to know more about your site and what it does. You can check your code and see if anything calls the "na_open_window" function.

    Out of curiosity why do you want to remove it? Is it causing a problem?

    Bill
    {{ DiscussionBoard.errors[2579448].message }}

Trending Topics