English 中文(简体)
页: 1 收音机
原标题:jQuery radio button value when it is hovered

我有10个无线电台塔顿/布顿台。 当然,每个纽州都有自己的价值,我想在纽伦被霸占时,在纽托邦旁显示价值。

我如何处理这个问题?

说明:

row1 : radio1.1 radio1.2 radio1.3 print value radio in here when radio is hovered

row2 : radio2.1 radio2.2 radio2.3 print value radio in here when radio is hovered

row3 : radio3.1 radio3.2 radio3.3 print value radio in here when radio is hovered

我利用了<条码>生命功能,从j Query获取活动mouseover,但我如何将这一数值具体放在特定的行文中?

我怎么能够拿到哪台无线电台,以便我获得其价值?

<!DOCTYPE html>
    <html>
    <head>
        <link href="jslib/jquery_theme/jquery.ui.all.css" rel="stylesheet" type="text/css"/>
      <script src="jslib/jquery-1.7.1.min.js"></script>
      <script src="jslib/jquery-ui-1.8.18.custom.min.js"></script>
      
      <script>
      $(document).ready(function() {
        $(".ter").buttonset();
      });
      
      
      
      $( .ter > label ).live( mouseover mouseout , function(event) {
      if (event.type ==  mouseover ) {
        document.getElementById( mydiv ).innerHTML = "Hello World";
      //this is when radio is hovered, it should show radio value beside the rwadio
      } else {
         document.getElementById( mydiv ).innerHTML = "out";
         //this is when mouse is out from radio
      }
});
  
$(function() {
    $("#radio :radio").change(function(e) {
       alert(
           "run ok"
       );
    });
});



  </script>


</head>
<body style="font-size:62.5%;">
  
<div id="radio">
    <form name= tes  method= post  action= a.php >
    <?php for($I=0;$I<10;$I++){ 
        
        echo"
        <div class= ter  style= border:1px solid; width:400px; margin-bottom:5px; >
      
    <input type= radio  id= radio1.$I  name= radio.$I  value= 4  /><label for= radio1.$I >  </label>
    <input type= radio  id= radio2.$I  name= radio.$I  checked= checked  value= 3  /><label for= radio2.$I > </label>
    <input type= radio  id= radio3.$I  name= radio.$I  value= 2  /><label for= radio3.$I > </label>
        <input type= radio  id= radio4.$I  name= radio.$I  value= 1 /><label for= radio4.$I > </label>
        <span id= mydiv >aaaaaaaaaa</span> 
        </div>  ";
         } ?>
        <div class= ter >
        <input type= submit  value = submit >
        </div>
    </form> 
            
</div>

</body>
</html>
问题回答

从您的言辞来看,这次活动将在无线电台举行。

$( input[type=radio] ).live({
   mouseover:function(){
      var value = $(this).attr( value );
      $(this).next().html(value);
   },
   mouseout:function(){
      $(this).next().html("");
   }
});

当无线电台被 h上时,它就会获得其价值并在标签上印刷。

$( .ter > label ).live( mouseover mouseout , function(event) {
  if (event.type ==  mouseover ) {
    document.getElementById( mydiv ).innerHTML = $("#"+$(this).attr("for")).val();
  //this is when radio is hovered, it should show radio value beside the rwadio
  } else {
     document.getElementById( mydiv ).innerHTML = "";
     //this is when mouse is out from radio
  }

这将使无线电价值与标签相对应,现在你可以相应地定位射线。

你们可以不使用 j印,只使用超文本和特别安全局:

<><><><>>><>>>>><>>>>>>>

​<form>
   <label><input type="radio" name="Test" value="Something"/></label>
   <label><input type="radio" name="Test" value="Something else"/></label>
</form>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

<>CSS

input:hover:after,
input:focus:after {
    content: attr(value);
    padding-left: 2em;
}​

这利用了CSScontent property,以提取和展示其适用要素的价值。 你们也许需要与特别安全局合作,以描述你们想要怎样做——我想绝对的位置,而不是每一行。

这在旧版本的IEE中赢得了一定的工作。 8+肯定会奏效——我不相信大约7个和以下。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签