Please tell me why?

Results 1 to 2 of 2

Thread: Please tell me why?

  1. #1
    Viet Hung Guest

    Default Please tell me why?

    I declare a button name "btnEnter"<BR><BR>&#060;INPUT TYPE="button" NAME="btnEnter" VALUE="Enter"><BR>&#060;/FORM><BR><BR>and script to handle the event OnClick:<BR><BR>&#060;%<BR> Sub btnEnter_OnClick<BR> Msgbox "Something happen"<BR> End Sub<BR>&#037;&#062;<BR><BR>but nothing&#039s happen when I click the button name btnEnter.<BR><BR>I have changed my code:<BR><BR>&#060;SCRIPT Language="VbScript"><BR>&#060;!--<BR> Sub btnEnter_OnClick<BR> Msgbox "Something happen"<BR> End Sub<BR>//--><BR>&#060;/SCRIPT><BR><BR>Please tell me why ?

  2. #2
    John Harvey Guest

    Default RE: Please tell me why?

    Did the second set of code work? (It should have.) The reason the first set of code doesn&#039t work is that the script delimiters &#060;% &#037;&#062; are for server script only. That code is executed before the page is sent to the browser. (If you loaded the page again and viewed its source, anything between the &#060;% &#037;&#062; tags will not be in the source listing). You want the button event handler to execute on the client&#039s machine, so you need to use the client-side &#060;SCRIPT> tag to have the client handle the onClick event.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •