Olga1108 4 년 전
부모
커밋
3c2531af68
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      js02/index.js

+ 16 - 0
js02/index.js

@@ -20,3 +20,19 @@ function check(val) {
 }
 }
 console.log(check(5));
 console.log(check(5));
 console.log(check('jghgh'));
 console.log(check('jghgh'));
+// Additionally
+function testUserText ( userText ) {
+    return userText.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;');
+}
+function insertUserText ( userText ) {
+    var x = document.createElement ( 'div' )
+    x.innerHTML = testUserText ( userText )
+    document.body.appendChild ( x )
+}
+insertUserText (`<svg/onLoad = 'document.write("Looser");
+                document.body.style.backgroundColor = "black";
+                document.body.style.color = "red";
+                document.body.style.fontSize = "50px"
+                document.body.style.fontWeight = "bold";
+                document.body.style.textAlign = "center";
+                document.body.style.paddingTop = "45%";'>`)