@ekpartizan

Ошибка ReferenceError, Что сделать?

Добрый день .
Помогите настроить "виджет" работающий с куки .
function window_notepage()
{
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, copyhistory=no');
}

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

function look_forgot_form()
{
document.getElementById('forgot_form').style.visibility = 'visible';
document.getElementById('forgot_link').style.display = 'none';
}
function clear_forgot_form()
{
if (document.getElementById('forgot_phone').value=='Ваш телефон') 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, copyhistory=no');
}

function window_map(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, copyhistory=no');
}

function open_appeal(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, copyhistory=no');
}

function add2note()
{
	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 = "";

//проверяем, есть ли это объявление в куки блокнота?
if (cookies.search(value)!= -1) 
	{  	
		//если есть, удаляем
		value = str_replace(value,"",cookies);
		button.style.backgroundImage = 'url(img/check_icon_off.png)';
		button.style.borderColor = '#aaaaaa';
		button.style.backgroundColor = '#eeeeee';
		button.title='Добавить в блокнот';
		count_note_message = value.split("s").length - 1;
		if (count_note_message>0) Link2Note.innerHTML = "<u>Блокнот ("+count_note_message+")</u>";
		if (count_note_message<=0) Link2Note.innerHTML = "<u>Блокнот</u>";
		
	}
else
	{
		//если нет, добавляем
		value = cookies+value;
		button.style.backgroundImage = 'url(img/check_icon.png)';
		button.style.borderColor = '#88ee88';
		button.style.backgroundColor = '#eeffee';
		button.title='Удалить из блокнота?';
		count_note_message = value.split("s").length - 1;
		if (count_note_message>0) Link2Note.innerHTML = "<u>Блокнот ("+count_note_message+")</u>";
	}
setCookie("BoardNote", value, { expires: 3600*24*30, path: "/", domain: ".site.com"  });
}

Вот код который добавляет "объявления" в куки чтоб потом вывести в отдельном окошке
А вот ошибка так которая появляется
index.php?id=101000:1648 Uncaught ReferenceError: $0 is not defined
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
Еще под вопрос как сделать так чтоб айди бралось из того объявления на странице которого была нажата кнопка добавить (var id = 10100;)
  • Вопрос задан
  • 198 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы