Jump to content

I need some insight regarding Browser


Rachit Shah

Recommended Posts

I need some insight regarding below code.In the below code...If I change <\/script> to </script> its giving error.If I change <\/head> to </head> its not giving error. Why? Why? Why?Here is the working code. Its working fine. The above scenario is visible here. I have put it in red.

<html><head><script id='script1' name='script1' type="text/javascript">function writeIt () {var x="";x = x + "<html>\n<head>\n";x= x + "<script>" + window.document.scripts(0).text;x = x + "<\/script>\n";x = x + "</head>\n<body>\n";x = x + document.body.innerHTML;x = x + "\n</body>\n</html>";alert(x);document.close(); // or document.open();document.write(x);}</script></head><body><input type="button" onclick="writeIt()" value="Write"/>rachit</body></html>
Is this thing Browser specific? I mean Implementation specific?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...