Error ReferenceError, What to do?

Good afternoon .
Help to configure the "widget" working with cookies .
window_notepage function()
{
var height_w=screen.height-250;
var left = (screen.width/2)-(650/2);
var top = (screen.height/2)-(height_w/2);
window.open('notepage.html','note_board','width=650,height='+height_w+',top='+top+',left='+left+',toolbar=0, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, history=no');
}

look_vip_form function()
{
document.getElementById('vip_form').style.visibility = 'visible';
document.getElementById('ifram_vip').src = "vip_action.inc.php?fid=2&id=9148519&nocache=8221";
}
look_delete_form function()
{
document.getElementById('delete_form').style.visibility = 'visible';
document.getElementById('delete_link').style.visibility = 'hidden';
}
clear_delete_form function()
{
if (document.getElementById('code').value=='enter code'), document.getElementById('code').value=";
}

look_forgot_form function()
{
document.getElementById('forgot_form').style.visibility = 'visible';
document.getElementById('forgot_link').style.display = 'none';
}
clear_forgot_form function()
{
if (document.getElementById('forgot_phone').value=='Your phone') document.getElementById('forgot_phone').value=";
}


function window_image(id_image)
{
var height_w=screen.height-250;
var left = (screen.width/2)-(830/2);
var top = (screen.height/2)-(height_w/2);
window.open('imageviewer.php?id='+id_image,'image_board','width=830,height='+height_w+',top='+top+',left='+left+',toolbar=0, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, history=no');
}

window_map function(coord)
{
var height_w=650;
var left = (screen.width/2)-(750/2);
var top = (screen.height/2)-(height_w/2);
window.open('mapviewer.php?coord='+coord,'image_board','width=750,height='+height_w+',top='+top+',left='+left+',toolbar=0, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, history=no');
}

open_appeal function(w,h)
{
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
window.open('appeal.inc.php?fid=2&id=9148519&key=bfae376374d542e0019a42753aeb68ac','appeal','width='+w+',height='+h+',top='+top+',left='+left+',toolbar=0, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, history=no');
}

add2note function()
{
 function str_replace(search, replace, subject) { return subject.split(search).join(replace);}
var button = document.getElementById('addnotepage');
var Link2Note = document.getElementById('Link2Note');
var count_note_message = 0;
var id = 10100;
var fid = 2;
value = fid+"i"+id+"s";
var cookies = getCookie("BoardNote");
if (cookies == undefined) cookies = "";

//check if it's the ad cookies in Notepad?
if (cookies.search(value)!= -1) 
 { 
 //if there, remove
 value = str_replace(value,"",cookies);
 button.style.backgroundImage = 'url(img/check_icon_off.png)';
 button.style.borderColor = '#aaaaaa';
 button.style.backgroundColor = '#eeeeee';
 button.title='add to Notepad';
 count_note_message = value.split("s").length - 1;
 if (count_note_message>0) Link2Note.innerHTML = "<u>Notepad ("+count_note_message+")</u>";
 if (count_note_message<=0) Link2Note.innerHTML = "<u>Notepad</u>";

}
else
{
 //if not, add
 value = cookies+value;
 button.style.backgroundImage = 'url(img/check_icon.png)';
 button.style.borderColor = '#88ee88';
 button.style.backgroundColor = '#eeffee';
 button.title='Remove from clipboard?';
 count_note_message = value.split("s").length - 1;
 if (count_note_message>0) Link2Note.innerHTML = "<u>Notepad ("+count_note_message+")</u>";
}
setCookie("BoardNote", value, { expires: 3600*24*30, path: "/", domain: ".site.com" });
}

Here is the code which adds "ads" in the cookie then display in a separate window
And here is the error that appears
index.php?id=101000:1648 Uncaught ReferenceError: $is not defined 0
at add2note (index.php?id=101000:1648)
at HTMLDivElement.onclick (index.php?id=101000:167)
add2note @ index.php?id=101000:1648
onclick @ index.php?id=101000:167
prntscr.com/hmymz2
The question how to make so that ID was taken from the ad on the page which was clicked the add button (var id = 10100;)
June 10th 19 at 15:24
0 answer

Find more questions by tags HTTP CookiesJavaScript