2 daylesslu daylesslu 于 2014.05.22 19:53 提问

ASP.NET中加入JS 改变表格中数据

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="webgf.GF" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



function HideShow() { hidetable.style.display = ""; } function calculateShanghai() { document.writeln("<h2>你好!</h2>"): }




  <table border="0" id="table1" width="60%" align="center">
  <tr>
  <td width="25%">城市名:</td>
  <td width="25%">
      <asp:DropDownList ID="TBCityName0" runat="server" Width="74px" 
          AutoPostBack="True" Height="19px" 
          onselectedindexchanged="TBCityName0_SelectedIndexChanged">
          <asp:ListItem>请选择</asp:ListItem>
          <asp:ListItem>北京市</asp:ListItem>
          <asp:ListItem>天津市</asp:ListItem>
          <asp:ListItem>河北省</asp:ListItem>
          <asp:ListItem>山西省</asp:ListItem>
          <asp:ListItem>内蒙古自治区</asp:ListItem>
          <asp:ListItem>辽宁省</asp:ListItem>
          <asp:ListItem>吉林省</asp:ListItem>
          <asp:ListItem>黑龙江省</asp:ListItem>
          <asp:ListItem>上海市</asp:ListItem>
          <asp:ListItem>江苏省</asp:ListItem>
          <asp:ListItem>浙江省</asp:ListItem>
          <asp:ListItem>安徽省</asp:ListItem>
          <asp:ListItem>福建省</asp:ListItem>
          <asp:ListItem>江西省</asp:ListItem>
          <asp:ListItem>山东省</asp:ListItem>
          <asp:ListItem>河南省</asp:ListItem>
          <asp:ListItem>湖北省</asp:ListItem>
          <asp:ListItem>湖南省</asp:ListItem>
          <asp:ListItem>广东省</asp:ListItem>
          <asp:ListItem>广西壮族自治区</asp:ListItem>
          <asp:ListItem>海南省</asp:ListItem>
          <asp:ListItem>重庆市</asp:ListItem>
          <asp:ListItem>四川省</asp:ListItem>
          <asp:ListItem>贵州省</asp:ListItem>
          <asp:ListItem>云南省</asp:ListItem>
          <asp:ListItem>西藏自治区</asp:ListItem>
          <asp:ListItem>陕西省</asp:ListItem>
          <asp:ListItem>甘肃省</asp:ListItem>
          <asp:ListItem>青海省</asp:ListItem>
          <asp:ListItem>宁夏回族自治区</asp:ListItem>
          <asp:ListItem>新疆维吾尔族自治区</asp:ListItem>
          <asp:ListItem>港澳台</asp:ListItem>
      </asp:DropDownList>
      <asp:DropDownList ID="TBCityName1" runat="server" Width="74px" 
          AutoPostBack="True" Height="19px" 
          onselectedindexchanged="TBCityName1_SelectedIndexChanged">
      </asp:DropDownList>
      <br />
      <asp:DropDownList ID="TBCityName" runat="server" Width="156px" Height="19px">
      </asp:DropDownList>
      </td>
  <td width="25%">装机容量:(兆瓦)</td>
  <td width="25%">
      <asp:TextBox ID="TBCapacity" runat="server" value="90"></asp:TextBox>
      </td>
  </tr>
  <tr>
  <td width="25%">每兆瓦投资:(万元)</td>
  <td width="25%">
      <asp:TextBox ID="TBInvestmentPMW" runat="server" value="880"></asp:TextBox>
      </td>
  <td width="25%">使用年限:(年)</td>
  <td width="25%">
      <asp:TextBox ID="TBUsedPeriod" runat="server" value="25"></asp:TextBox>
      </td>
  </tr>
  <tr>
  <td width="25%">含税上网电价:(元/度)</td>
  <td width="25%">
      <asp:TextBox ID="TBElectricityPriceT" runat="server" value="1"></asp:TextBox>
      </td>
  <td width="25%">售电增值税税率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBElectricitySellingVATRate" runat="server" value="17"></asp:TextBox>
      </td>
  </tr>
   <tr>
  <td width="25%">银行货款比例:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBRatioLoans" runat="server" value="70"></asp:TextBox>
      </td>
  <td width="25%">年货款利率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBInterestRate" runat="server" value="6.55"></asp:TextBox>
      </td>
  </tr>
  </table>
  <table id="hidetable" border="0" width="60%" align="center" runat="Server" style="display:none">
   <tr>
  <td width="25%">其它费用(万元)</td>
  <td width="25%">
      <asp:TextBox ID="TBQiTaFeiYong" runat="server" value="0"></asp:TextBox>
      </td>
  <td width="25%">设备净残率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBRSheBeiJingCang" runat="server" value="5"></asp:TextBox>
      </td>
  </tr>
   <tr>
  <td width="25%">日常投资费用:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBRRiChangTouZi" runat="server" value="10"></asp:TextBox>
      </td>
  <td width="25%">大修费用:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBRDaXiu" runat="server" value="10"></asp:TextBox>
      </td>
  </tr>
         <tr>
  <td width="25%">路线更换费用:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBRLuXianGengHuan" runat="server" value="6"></asp:TextBox>
      </td>
  <td width="25%">经营期薪酬费用比例:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBJingYingQiPay" runat="server" value="0.19"></asp:TextBox>
      </td>
  </tr>
         <tr>
  <td width="25%">保险费用:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBRBaoXian" runat="server" value="0.15"></asp:TextBox>
      </td>
  <td width="25%">所得税率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBSuoDeShuiLv" runat="server" value="25"></asp:TextBox>
      </td>
  </tr>
  <tr>
  <td width="25%">预留金额参数:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBRYuLiuJinE" runat="server" value="10.0"></asp:TextBox>
      </td>
  <td width="25%">城市税率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBChengShiShuiLv" runat="server" value="7"></asp:TextBox>
      </td>
  </tr>
  <tr>
  <td width="25%">教育税率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBJiaoYuShuiLv" runat="server" value="3"></asp:TextBox>
      </td>
  <td width="25%">折现率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBXianZhiXiShu" runat="server" value="8"></asp:TextBox>
      </td>
  </tr>
  <tr>
  <td width="25%">固定资产系数:</td>
  <td width="25%">
      <asp:TextBox ID="TBdGuDingZiChangXiShu" runat="server" value="0.98"></asp:TextBox>
      </td>
  <td width="25%">发电效率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBR" runat="server" value="82"></asp:TextBox>
      </td>
  </tr>
  <tr>
  <td width="25%">年衰减率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBRNianShuaiJianRate" runat="server" value="0.8"></asp:TextBox>
      </td>
  <td width="25%">上网率:(%)</td>
  <td width="25%">
      <asp:TextBox ID="TBRShangWang" runat="server" value="100"></asp:TextBox>
      </td>
  </tr>
  </table>
</div>
<div>
    <table border="0" cellspacing="0" cellpadding="0" align="center" 
        style="height: 252px; width: 60%">
        <tr>
            <td style="text-align:right">   
                <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">显示更多参数</asp:LinkButton>
            </td>
        </tr>
        <tr>
            <td style="text-align:center">
                <asp:Button ID="BCalculate" runat="server" Text="计算" onclick="BCalculate_Click"   />
                <asp:Button ID="BClear" runat="server" Text="清空" onclick="BClear_Click" />
            </td>
        </tr>
        <tr>
            <td style="text-align:center">

                <asp:Label ID="Label3" runat="server" BackColor="Blue" Font-Names="微软雅黑" 
                    Font-Size="Large" ForeColor="White"></asp:Label>
                <br />
                <asp:Label ID="Label4" runat="server" BackColor="Blue" BorderColor="Blue" 
                    Font-Names="微软雅黑" Font-Size="Large" ForeColor="White"></asp:Label>
                <br />
                <asp:Label ID="Label2" runat="server" Visible="False"></asp:Label>
                <br />

                <asp:Label ID="Label1" runat="server" Visible="False"></asp:Label>
                <br />
                <asp:Label ID="Label5" runat="server" Visible="False"></asp:Label>

<asp:GridView ID="GridView1" runat="server" EnableModelValidation="True" 
    style="text-align: center" BackColor="White" BorderColor="#3366CC" BorderStyle="None" 
                    BorderWidth="1px" CellPadding="4" Visible="False">
    <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
    <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
    <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
    <RowStyle BackColor="White" ForeColor="#003399" />
    <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
</asp:GridView>

            </td>
        </tr>
    </table>
</div>
</form>



上面是源代码 要实现的功能是:修改原始初值,对于百分比的,正负10%浮动(加减),每次浮动1%,对于数值的,从数值的90%到110%浮动,每次变动1%,能将得到的数据在页面全部显示出来,每次只要变动一个数据就好了,将所有的都跑一遍。毕设,来不及学js,忘谅解伸手党!

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!