0

我有一个通过 PHP 创建的动态表行,如下所示:

 while($carrier = mysql_fetch_array($selcomp)){
                $carrier1 = $carrier['carname'];
            }
            ?>
            <tr ><td><a class='activate_modal' name='<?php echo $leadlist['ID'];?>' href="#"><input id="soft-quote" type="button" value="Soft Quote" class="searchbutton" /></a></td></tr>
            <?
         }

我需要以某种方式通过

      name='<?php echo $leadlist['ID'];?>'

通过对话框打开

 $( "#dialog-form" ).dialog({
        autoOpen: false,
        height: 300,
        width: 350,
        modal: true,
        buttons: {
            "Complete Soft Quote": function() {
                var bValid = true;
                allFields.removeClass( "ui-state-error" );


                if ( bValid ) {
                          // call to some ajax.
                    $( this ).dialog( "close" );
                }
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        },
        close: function() {
            allFields.val( "" ).removeClass( "ui-state-error" );
        }
    });

        $('.activate_modal').click(function(){

            var rowid = $(this).attr('name');

            $( "#dialog-form" ).dialog( "open" );

        });

无论是形式:

<div id="dialog-form" title="Create Soft Quote">
<p class="validateTips">All form fields are required.</p>

<form>
<fieldset>
    <label for="payroll">Payroll</label>
    <div id="yourelement"></div>
    <input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
    <label for="email">Email</label>
    <input type="text" name="email" id="email" value="" class="text ui-widget-content ui-corner-all" />
    <label for="taxid">Federal Tax ID</label>
    <input type="text" name="taxid" id="taxid" value="" class="text ui-widget-content ui-corner-all" />
</fieldset>
</form>

或者直接jquery函数。有什么建议么?

4

1 回答 1

0

试试这个。

$('.activate_modal').click(function(){
   var rowid = $(this).attr('name');
   alert(rowid);
   $('#taxid').after('<input type="hidden" name="rowid" id="rowid" value="'+rowid+'" />');   
   $('#dialog-form').dialog('open');
});
于 2012-12-14T06:11:54.000 回答