J
J
Jasee Cambatch2017-12-13 16:56:41
JavaScript
Jasee Cambatch, 2017-12-13 16:56:41

ReferenceError Error, What to do?

Good afternoon .
Help set up a "widget" that works with cookies.

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"  });
}

Here is the code that adds "declarations" to the cookie so that it can be displayed in a separate window
, and here is the error that appears
index.php
? at
HTMLDivElement.onclick (index.php?id=101000:167)
add2note @ index.php?id=101000:1648
onclick @ index.php?id=101000:167
prntscr.com/hmymz2
was taken from the ad on the page of which the add button was pressed (var id = 10100;)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question