HTML mit JS fehlerhaft
-
In einem HTMTL block benutze ich den folgenden Code:
<div style="text-align: center; font-size: 13px; margin-top: 10px;">
<a onclick="const popupCenter = ({ url, title, w, h }) => {
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
const width = window.innerWidth || document.documentElement.clientWidth || screen.width;
const height = window.innerHeight || document.documentElement.clientHeight || screen.height;
const systemZoom = width / window.screen.availWidth;
const left = (width - w) / 2 / systemZoom + dualScreenLeft;
const top = (height - h) / 2 / systemZoom + dualScreenTop;
const newWindow = window.open(url, title,scrollbars=yes, width=${w / systemZoom}, height=${h / systemZoom}, top=${top}, left=${left}
);
if (window.focus) {
newWindow.focus();
}
};
popupCenter({ url: '/nn', title: 'Popup', w: 350, h: 750 });"><strong>NN</strong></a>
<br />
<a href="#ort">Ort</a> (Südost)</div>Die Endquote des JS wird nicht erkannt. Wo ist der Fehler?
Der Zweck des Codes ist es, ein Fenster vorgegebener Größe in der Mitte des Bildschirms auszugeben.
Ansicht von 7 Antworten – 1 bis 7 (von insgesamt 7)
Ansicht von 7 Antworten – 1 bis 7 (von insgesamt 7)
- Du musst angemeldet sein, um auf dieses Thema zu antworten.