Javascript div隐藏并显示PHP内的from复选框
我在html页面中有一个按钮点击事件,我正在调用一个PHP文件。在php中,我有两个div,我想根据我的复选框显示隐藏。。。 现在它显示了两个复选框和show div。但是我只想在用户选中第一个复选框的情况下加载show div。我如何实现这一点?请帮助。这里是PHP代码Javascript div隐藏并显示PHP内的from复选框,javascript,php,html,Javascript,Php,Html,我在html页面中有一个按钮点击事件,我正在调用一个PHP文件。在php中,我有两个div,我想根据我的复选框显示隐藏。。。 现在它显示了两个复选框和show div。但是我只想在用户选中第一个复选框的情况下加载show div。我如何实现这一点?请帮助。这里是PHP代码 <div id="dialog_title"> <input type="checkbox" name="First" value="First"> First List<br>
<div id="dialog_title">
<input type="checkbox" name="First" value="First">
First List<br>
<input type="checkbox" name="Second" value="Second">Second
</div>
<div id="Show div">
<table>
<tr>
<th> Name </th>
<th> Address </th>
</tr>
<?php
foreach ( $deviceArr as $device) {
$id = $device['id'];
$name = $device ['name'];
$Address = $device['address'];
?>
<tr class="font1">
<td> <input type="text" class="g_input_text" name="name[]" value="<?php echo $name; ?>" /> </td>
<td>
<input type="text" class="g_input_text" name="address[]" value="<?php echo $Address; ?>" />
<input type="hidden" name="id[]" value="<?php echo $id; ?>" />
</td>
</tr>
<?php
}
?>
</table>
</div>
第一个列表
第二
名称
地址
这就是你所期待的
$(document).ready(function() {
$('#Show').hide();
$("input[name=First]").click(function () {
$('#Show').toggle();
});
});
这件事是在家里完成的。查找
注意:将
更改为
这是您所期望的吗
$(document).ready(function() {
$('#Show').hide();
$("input[name=First]").click(function () {
$('#Show').toggle();
});
});
这件事是在家里完成的。查找
注意:将
更改为
这是您所期望的吗
$(document).ready(function() {
$('#Show').hide();
$("input[name=First]").click(function () {
$('#Show').toggle();
});
});
这件事是在家里完成的。查找
注意:将
更改为
这是您所期望的吗
$(document).ready(function() {
$('#Show').hide();
$("input[name=First]").click(function () {
$('#Show').toggle();
});
});
这件事是在家里完成的。查找
注意:加载页面时,将
更改为隐藏名为first\u list\u bx的显示div
并将id设置为first\u chk\u bx
到first复选框,如:
<input type="checkbox" name="First" value="First" id="first_chk_bx">
<div id="first_list_bx" style="display:none;">
//code
</div>
加载页面时,隐藏名为first_list_bx
的show div
i,并将id设置为first_chk_bx
给first复选框,如:
<input type="checkbox" name="First" value="First" id="first_chk_bx">
<div id="first_list_bx" style="display:none;">
//code
</div>
加载页面时,隐藏名为first_list_bx
的show div
i,并将id设置为first_chk_bx
给first复选框,如:
<input type="checkbox" name="First" value="First" id="first_chk_bx">
<div id="first_list_bx" style="display:none;">
//code
</div>
加载页面时,隐藏名为first_list_bx
的show div
i,并将id设置为first_chk_bx
给first复选框,如:
<input type="checkbox" name="First" value="First" id="first_chk_bx">
<div id="first_list_bx" style="display:none;">
//code
</div>
当你用javascript
标记你的问题时,在你的html中试试这个js函数
HTML
<div id="dialog_title">
<input type="checkbox" name="First" value="First" onclick="javascript:show_hide(this, 'Show_div')">
First List<br>
<input type="checkbox" name="Second" value="Second">Second
</div>
<div id="Show_div" style="display:none">
<table>
<tr>
<th> Name </th>
<th> Address </th>
</tr>
<?php
foreach ( $deviceArr as $device) {
$id = $device['id'];
$name = $device ['name'];
$Address = $device['address'];
?>
<tr class="font1">
<td> <input type="text" class="g_input_text" name="name[]" value="<?php echo $name; ?>" /> </td>
<td>
<input type="text" class="g_input_text" name="address[]" value="<?php echo $Address; ?>" />
<input type="hidden" name="id[]" value="<?php echo $id; ?>" />
</td>
</tr>
<?php
}
?>
</table>
</div>
第一个列表
第二
名称
地址
当你用javascript
标记你的问题时,在你的html中试试这个js函数
HTML
<div id="dialog_title">
<input type="checkbox" name="First" value="First" onclick="javascript:show_hide(this, 'Show_div')">
First List<br>
<input type="checkbox" name="Second" value="Second">Second
</div>
<div id="Show_div" style="display:none">
<table>
<tr>
<th> Name </th>
<th> Address </th>
</tr>
<?php
foreach ( $deviceArr as $device) {
$id = $device['id'];
$name = $device ['name'];
$Address = $device['address'];
?>
<tr class="font1">
<td> <input type="text" class="g_input_text" name="name[]" value="<?php echo $name; ?>" /> </td>
<td>
<input type="text" class="g_input_text" name="address[]" value="<?php echo $Address; ?>" />
<input type="hidden" name="id[]" value="<?php echo $id; ?>" />
</td>
</tr>
<?php
}
?>
</table>
</div>
第一个列表
第二
名称
地址
当你用javascript
标记你的问题时,在你的html中试试这个js函数
HTML
<div id="dialog_title">
<input type="checkbox" name="First" value="First" onclick="javascript:show_hide(this, 'Show_div')">
First List<br>
<input type="checkbox" name="Second" value="Second">Second
</div>
<div id="Show_div" style="display:none">
<table>
<tr>
<th> Name </th>
<th> Address </th>
</tr>
<?php
foreach ( $deviceArr as $device) {
$id = $device['id'];
$name = $device ['name'];
$Address = $device['address'];
?>
<tr class="font1">
<td> <input type="text" class="g_input_text" name="name[]" value="<?php echo $name; ?>" /> </td>
<td>
<input type="text" class="g_input_text" name="address[]" value="<?php echo $Address; ?>" />
<input type="hidden" name="id[]" value="<?php echo $id; ?>" />
</td>
</tr>
<?php
}
?>
</table>
</div>
第一个列表
第二
名称
地址
当你用javascript
标记你的问题时,在你的html中试试这个js函数
HTML
<div id="dialog_title">
<input type="checkbox" name="First" value="First" onclick="javascript:show_hide(this, 'Show_div')">
First List<br>
<input type="checkbox" name="Second" value="Second">Second
</div>
<div id="Show_div" style="display:none">
<table>
<tr>
<th> Name </th>
<th> Address </th>
</tr>
<?php
foreach ( $deviceArr as $device) {
$id = $device['id'];
$name = $device ['name'];
$Address = $device['address'];
?>
<tr class="font1">
<td> <input type="text" class="g_input_text" name="name[]" value="<?php echo $name; ?>" /> </td>
<td>
<input type="text" class="g_input_text" name="address[]" value="<?php echo $Address; ?>" />
<input type="hidden" name="id[]" value="<?php echo $id; ?>" />
</td>
</tr>
<?php
}
?>
</table>
</div>
第一个列表
第二
名称
地址
如何使用表单post或javascript调用php文件?如何使用表单post或javascript调用php文件?如何使用表单post或javascript调用php文件?如何使用表单post或javascript调用php文件?