I am trying to inject a script to create an xss. My html input tag look like:
<div>
User name:
</div>
<div>
<input type="text" id="uname" onblur="unOut()">
</div>
<div id="unamewar" style="display:none;color:red; background-color:#ffe4b5">
</div>
And my javascript looks like:
function unOut(){
var x;
x = document.getElementById("uname").value;
if(x != ""){
document.getElementById("unamewar").innerHTML = x;
}
So here when I try to inject a html tag say, "< h1 > Hai < /h1 >", it works as an html injection (i.e.) 'Hai' is displayed as a header in the div unamewar. But when I try the same with a script tag, for example, "< script >alert("Hai);< /script >", it doesn't get executed. I would like to know how to inject a script as an xss in my code.