标题:asp初学者求助!!
只看楼主
kaka2010
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-1-12
结帖率:0
已结贴  问题点数:20 回复次数:3 
asp初学者求助!!


<%@page language="vb"%>
   <html>
      <script language="vb" runat="server">
         dim strtemp as string
         sub buttonclick(Sender as object,E as EventArgs)
           strtemp="您好,您选择了:<br>"
           if chk1.Checked then strtemp=strtemp & "跑步<br>"
           if chk2.Checked then strtemp=strtemp & "体操<br>"
         end sub
     </script>
  <body>
    <form runat="server">
      请告诉我你喜爱的运动项目是:<br>
     <input type=checkbox runat=server id=chk1>跑步</br>
     <input type=checkbox runat=server id=chk2>体操</br>
     <input type=button ruant=server value="提交" onserverclick="buttonclick"><br>
     <%=strtemp%>
    </form>
  </body>
  </html>



这段代码为何没有显示结果?请问高手们错误在哪里??
搜索更多相关主题的帖子: asp 
2010-01-12 17:01
yms123
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:20 
strtemp变量你输出了吗?
这个变量的显示语句在哪?
2010-01-13 13:45
kaka2010
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-1-12
得分:0 
是不是要加一个Response.Write(strtemp),加上也没显示,真的搞不懂了,刚学就被打击了
2010-01-13 17:06
yms123
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebApplication5.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <HEAD>
        <title>WebForm1</title>
        <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" content="http://schemas.
        <script language="vb" runat="server">
         dim strtemp as string
         Private Sub Button1_Click(sender As System.Object,e As System.EventArgs)
           strtemp="您好,您选择了:<br>"
           if chk1.Checked then strtemp=strtemp & "跑步<br>"
           if chk2.Checked then strtemp=strtemp & "体操<br>"
           Label2.Text=strtemp
         End Sub         
        </script>
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <FONT face="宋体">
                <asp:CheckBox id="chk1" style="Z-INDEX: 101; LEFT: 32px; POSITION: absolute; TOP: 48px" runat="server"
                    Width="120px" Height="16px" Text="跑步"></asp:CheckBox>
                <asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 40px; POSITION: absolute; TOP: 16px" runat="server"
                    Width="192px" Height="24px">请告诉我你最喜爱的运动是</asp:Label>
                <asp:CheckBox id="chk2" style="Z-INDEX: 103; LEFT: 32px; POSITION: absolute; TOP: 88px" runat="server"
                    Width="112px" Height="8px" Text="体操"></asp:CheckBox>
                <asp:Button id="Button1" style="Z-INDEX: 104; LEFT: 40px; POSITION: absolute; TOP: 128px" runat="server"
                    Width="88px" OnClick="Button1_Click" Text="提交"></asp:Button>
                <asp:Label id="Label2" style="Z-INDEX: 105; LEFT: 32px; POSITION: absolute; TOP: 168px" runat="server"
                    Width="216px" Height="24px"></asp:Label>
            </FONT>
        </form>
    </body>
</HTML>
2010-01-13 19:52



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-295559-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.226421 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved