html lang = " en-US " >
< Kopf >
< meta charset = " utf-8 " >
< title > Beispiel für ein JavaScript-Label title >
< style >
p {
Schriftfamilie : 'helvetica neue' , helvetica , serifenlos;
Buchstabenabstand : 1 px ;
Texttransformation : Großbuchstaben;
Textausrichtung : Mitte;
Rand : 2 px festes rgba ( 0 , 0 , 200 , 0,6 );
Hintergrund : rgba ( 0 , 0 , 200 , 0,3 );
Farbe : rgba ( 0 , 0 , 200 , 0,6 );
Kastenschatten : 1 px 1 px 2 px rgba ( 0 , 0 , 200 , 0,4 );
Randradius : 10 px ;
Polsterung : 3 px 10 px ;
Anzeige : Inline-Block;
Cursor : Zeiger;
}}
style >
head >
< Körper >
< p > Spieler 1: Chris p >
< skript >
const para = Dokument . querySelector ( 'p' ) ;
Abs . addEventListener ( 'click' , updateName ) ;
Funktion updateName ( ) {
let name = prompt ( 'Neuen Namen eingeben' ) ;
Abs . textContent = 'Spieler 1:' + Name ;
}}
script >
body >
html >