show the codes of the onclick function of the confirm button,pls.

解决方案 »

  1.   

    Do you use the function of select onchange event to make it ???
      

  2.   

    是onblur,
    <select id="test" onblur="onChange()" name="format">....
    -----------------------------------------
    function onChange(){
             var e=event.srcElement;
    document.getElementById("Label1").innerText = e.options(e.selectedIndex).value;
    }
      

  3.   

    跟这个有关系么?之前我用onclick,不过有点问题(用滚轮改变select的时候,如果经过optgroup的时候就不会触发onclick,这个先不管吧),就改成onblur了附:
    <select id="test" onblur="onChange()" name="format">
    <optgroup label="横幅">
    <option value="728x90" selected>728 x 90</option>
    <option value="468x60">468 x 60</option>
    <option value="234x60">234 x 60</option>
    </optgroup>
    <optgroup label="垂直">
    <option value="120x600">120 x 600</option>
    <option value="160x600">160 x 600</option>
    <option value="120x240">120 x 240</option>
    </optgroup>
    <optgroup label="正方形">
    <option value="125x125">125 x 125</option>
    <option value="300x250">300 x 250</option>
    <option value="250x250">250 x 250</option>
    <option value="336x280">336 x 280</option>
    <option value="180x150">180 x 150</option>
    </optgroup></select>
      

  4.   

    <select id="test" onChange="func(this)" name="format">....
    -----------------------------------------
    function func(a){

      document.getElementById("Label1").innerText = a.options(a.selectedIndex).value;
    }
      

  5.   

    用了ming兄那种方式,可惜问题依旧客户端控件怎样向服务端控件传数据??
      

  6.   

    Label的数据传不过去的 document.getElementById("hid").innerText = a.options(a.selectedIndex).value;
    <input type="hidden" id="hid">用hidden,取法和text一样
      

  7.   

    function func(a){

      document.getElementById("Label1").innerText = a.options(a.selectedIndex).value;
      document.getElementById("hid").innerText = a.options(a.selectedIndex).value;

    }<input type="hidden" id="hid">
      

  8.   

    不好意思,“取法和text一样”不太明白,我在程序中怎么读它的值?要在c#程序中找到hid它应该设runat=server的对吧,不过我一向服务器提交它也会被还原成初始值!
    吃饭先,多谢各位回复!!!!!!!!!!
      

  9.   

    别的东西变了会还原吗?如text,你的流程多看看
      

  10.   

    TextBox不会,但是select会,比如说我在js中将TextBox1的值设为468x60,此时select的值也是这个,提交以后select的值变回原来初始值(728x90),而TextBox1则仍保持为468x60,为什么会这样???
      

  11.   

    TextBox不会,但是select会,比如说我在js中将TextBox1的值设为468x60,此时select的值也是这个,提交以后select的值变回原来初始值(728x90),而TextBox1则仍保持为468x60,为什么会这样???------------------------------------
    The textbox changes because it is a c# element on the web page.HTML elements will go back its default value when the page refreshs.But don't worry,the data it submited to server is the value you selected,not its default value.
      

  12.   

    那如果我想让HTML控件的值不被设为默认值该怎样做?做不到么???
      

  13.   

    html控件首先要runat="server",然后不能禁用viewstate,html控件的初始化过程只在!IsPostBack中出现