函数如下:
function input_radiocheck($type, $element_name, $values, $element_value) {
print \'<input type=\"\' . $type . \'\" name=\"\' . $element_name .\'\" value=\"\' . $element_value . \'\" \';
if ($element_value == $values[$element_name]) {
print \' checked=\"checked\"\';
}
print \'/>\';
}
该函数有四个参数:
- $type表示要输出的是复选框还是单选按钮,其值可以是radio和checkbox
- $element_name表单表单元素的name属性值
- $values表示设置默认选中的表单元素的值
- $element_value表示表单元素的值
使用实例:
input_radiocheck(\"radio\",\"radiobutton\",\'1\',\'1\');
input_radiocheck(\"radio\",\"radiobutton\",\'1\',\'2\');
input_radiocheck(\"radio\",\"radiobutton\",\'1\',\'2\'); 继续阅读与本文标签相同的文章
-
城市数字化后,新一代内生安全系统可全方位保护
2026-05-14栏目: 教程
-
谷歌也来“唱衰”5G,5G手机只会徒增功耗?为何这么说?
2026-05-14栏目: 教程
-
量子信息和量子技术白皮书合肥宣言在中科大发布
2026-05-14栏目: 教程
-
微信悄悄更新一新功能,来看看!
2026-05-14栏目: 教程
-
打破三大运营商垄断,第四大运营商终于来了!
2026-05-14栏目: 教程
