-3


i have this php code:

echo "<div class='show-popup'><a class='button-popup-container-right' href='javascript:apri('popup.html');' target='_blank'><i class='far fa-play-circle'></i>&nbsp;ASCOLTA LA RADIO</span></a></div>"

but, when i click on the link the path is only "javascript:apri("

I have inserted this script in the footer of the page

function apri(url) { 
    newin = window.open(url,'Player','top=50, left=50,scrollbars=no,resizable=yes,width=400,height=550,status=no,location=no,toolbar=no,nomenubar=no');
} 

Can anyone help me please?

1 Answers1

-2
href='javascript:apri('

The first ' marks the start of the attribute value. The second ' marks the end of the attribute value.

If you want to include ' as data then you need to either use " to delimit the attribute value or to escape the ' as &apos;.

You can avoid this problem by writing Unobtrusive JavaScript and binding your event handlers with addEventListener.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335