I am trying to create a DOM based attack using a html file. The file is as follows :
<html>
<head>
<script type="text/javascript">
function fun() {
var val = document.getElementById("mytext").value;
document.getElementById("p1").innerHTML = unescape(val);
}
</script>
</head>
<body>
<p id ="p1">Empty</p>
Give input : <input id="mytext" type="text" value="abcd" >
<input type="button" id="b1" onclick="fun()" value="Change link" >
</body>
</html>
When I pass <script>alert('hello world');</script>
inside the text box and click on the button the p tag doesn't run the script. What might be the possible reason? I am learning XSS for testing our website for security.