Advertisement
Guest User

Untitled

a guest
Apr 15th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. public partial class home : System.Web.UI.Page
  2. {
  3. protected void Page_Load(object sender, EventArgs e)
  4. {
  5.  
  6. }
  7. private string chatitems
  8. {
  9. get
  10. {
  11. if(Application["un"]==null)
  12. Application["un"] = "";
  13. return Application["un"].ToString();
  14. }
  15. set
  16. {
  17. Application["un"] = value;
  18. }
  19. }
  20. protected void Timer1_Tick(object sender, EventArgs e)
  21. {
  22. Label1.Text = chatitems;
  23. }
  24. protected void Button1_Click(object sender, EventArgs e)
  25. {
  26. chatitems = txt.Text + "<br />" + chatitems;
  27. }
  28. }
  29.  
  30. <input id="submitButton" type="submit" value="Submit"/>
  31.  
  32. </body>
  33.  
  34. <script type="text/javascript">
  35. // select the button element
  36. var button = document.getElementById('submitButton');
  37. // add an event listener for the on click event.
  38. button.AddEventListener("onClick", function(){
  39. var txt = document.getElementById('<%=txt.ClientId%>');
  40. // I suppose that you will define the chatitems somewhere above, because I don't //get its use, reading your code.
  41. chatitems += txt.val()+"<br/>";
  42. });
  43. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement