藍森林首頁 | 返回主頁 | 本站地圖 | 站內搜索 | 聯繫信箱 |
 您目前的位置:首頁 > 自由軟件 > 技術交流 > 應用編程


    

藍森林 http://www.lslnet.com 2006年8月25日 8:28

表格與單選按鈕

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<table  cellspacing="0" class="DGStyle" rules="all" border="1" id="DGInsureUser" style="border-collapse: collapse" width="795" height="37">         
<tr style="background-color:WhiteSmoke;">
                   <td width="28" height="1" ><font size="2">選擇</font></td>
                   <td width="38" height="1" ><font size="2">&nbsp;經度</font></td>
                   <td width="110" height="1" ><font size="2">緯度</font></td>
                   <td width="50" height="1" ><font size="2">速度</font></td>
                   <td width="50" height="1" ><font size="2">方向</font></td>
                   <td width="67" height="1"><font size="2">狀態</font></td>
                </tr>
       
        <tr>
                <td width="28" height="13">
          <p align="center"><input type="radio" value="V1" checked name="R1"></p>
        </td>
                <td width="38" height="13" ><font size="2">116.97477</font></td>
                <td width="110" height="13"><font size="2">33.665995</font></td>
                <td width="50" height="13"><font size="2">20.2</font></td>
                <td width="50" height="13"><font size="2">120.3</font></td>
                <td width="67" height="13"><font size="2">正常</font></td>
               
        </tr>
       
        <tr >
                <td width="28" height="1">
          <p align="center"><input type="radio" value="V1" checked name="R1"></p>
        </td>
                <td  width="38" height="1"><font size="2">116.975711</font></td>
                <td width="110" height="1"><font size="2">33.6399</font></td>
                <td width="50" height="1"><font size="2">12.4</font></td>
                <td width="50" height="1"><font size="2">15</font></td>
                <td width="67" height="1"><font size="2">正常</font></td>
               
        </tr>
       
</table>
</body>
</html>
當我單擊前面的單選按鈕時,如何才能得到這一行中的經度和緯度的值呢?

dfgdg

[html]<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<script>
function jw(obj)
  {
   while (obj=obj.parentElement)
          {if (obj.tagName=='TR') break;}
alert('經度為:'+obj.cells(1).innerText+'\n緯度為:'+obj.cells(2).innerText);
   
  }
</script>
</head>
<body>
<table cellspacing="0" class="DGStyle" rules="all" border="1" id="DGInsureUser" style="border-collapse: collapse" width="795" height="37">     
<tr style="background-color:WhiteSmoke;">
         <td width="28" height="1" ><font size="2">選擇</font></td>
         <td width="38" height="1" ><font size="2">&nbsp;經度</font></td>
         <td width="110" height="1" ><font size="2">緯度</font></td>
         <td width="50" height="1" ><font size="2">速度</font></td>
         <td width="50" height="1" ><font size="2">方向</font></td>
         <td width="67" height="1"><font size="2">狀態</font></td>
        </tr>
   
    <tr>
        <td width="28" height="13">
<p align="center"><input type="radio" value="V1" checked name="R1" onclick=jw(this)></p>
</td>
        <td width="38" height="13" ><font size="2">116.97477</font></td>
        <td width="110" height="13"><font size="2">33.665995</font></td>
        <td width="50" height="13"><font size="2">20.2</font></td>
        <td width="50" height="13"><font size="2">120.3</font></td>
        <td width="67" height="13"><font size="2">正常</font></td>
        
    </tr>
   
    <tr >
        <td width="28" height="1">
<p align="center"><input onclick=jw(this) type="radio" value="V1" checked name="R1"></p>
</td>
        <td width="38" height="1"><font size="2">116.975711</font></td>
        <td width="110" height="1"><font size="2">33.6399</font></td>
        <td width="50" height="1"><font size="2">12.4</font></td>
        <td width="50" height="1"><font size="2">15</font></td>
        <td width="67" height="1"><font size="2">正常</font></td>
        
    </tr>
   
</table>
</body>
</html>
[/html]




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : webmaster@lslnet.com