Abdu_Allah
asked on
How to javascript code in a different lines using RegisterStartupScript
Hi; How to javascript code in a different lines using RegisterStartupScript , foexample, consider the following code:
Page.ClientScript.Register StartupScr ipt(this.G etType(), "yyh", "<script>alert('1'); alert('2');</script>");
This function will print the code in the web page as the following "<script>alert('1'); alert('2');</script>
How to make it printed like this:
<script>
alert('1');
alert('2');
</script>
Page.ClientScript.Register
This function will print the code in the web page as the following "<script>alert('1'); alert('2');</script>
How to make it printed like this:
<script>
alert('1');
alert('2');
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
line breal "\n" does not work.
the first one I provided should work.
Still if you want to use \n here it is:
Page.ClientScript.Register StartupScr ipt(this.G etType(), "yyh", "<script>\n alert('1');\n alert('2');\n </script>");
Copy+paste this ...it is tested and works.
Still if you want to use \n here it is:
Page.ClientScript.Register
Copy+paste this ...it is tested and works.
"<script>\nalert('1');\nalert('2');\n</script>"