Click here to Skip to main content
15,920,632 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi'
How the Response.Write can be use in javascript and body
Is <%= %> an instruction of ASP instructions? AND it use in javascript and body
Posted
Comments
Eduard Keilholz 16-May-11 2:46am    
Your question is not clear, it's a scattered bunch of terms. Try to edit your question so your problem becomes clear.

Your question is not quite clear but you need to read on Response.Write.

Read: Response.Write Method[^]


Now, for injecting JavaScript into HTML using Response.Write:
C#
Response.Write("<script language="javascript">");
Response.Write("alert('Hello World!');");
Response.Write("return false;");
Response.Write("</script>");
 
Share this answer
 
v2
<%= "hello!" %> and <% Response.Write("hello!") %> both are identical. they produce same output.

Actually <% %> is used to execute ASP.NET server side statements and <%= %> is shortcut of Response.Write.

in <% %> you can write any server side code which will be executed at runtime.
Thanks,
Hemant
 
Share this answer
 
v2
Comments
cungo_bu 28-Feb-12 4:17am    
When using <%= "hello!" %>, I can write in any place in client side (even on javascript) but when using <% Response.Write("hello!") %>, it always write on <body>.
Do you know why?
XML
<%@ language="javascript"%>
<html>
<body>
<%
Response.Write("Hello World!")
%>
</body>
</html>


You can use javascript like this in your ASP page.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900