[英]Print Check Box Selected Data only
Hi i am having results and its contains a checkbox as <input type='checkbox' name="ChkS[]" value='<? echo $rs->id?>'>
嗨,我有结果,它包含一个复选框,作为<input type='checkbox' name="ChkS[]" value='<? echo $rs->id?>'>
<input type='checkbox' name="ChkS[]" value='<? echo $rs->id?>'>
I have a print out list option in the footer as <input type="button" value="Show Printable List" class="butten" onClick="openPrint()">
我在页脚中有一个打印输出列表选项,为<input type="button" value="Show Printable List" class="butten" onClick="openPrint()">
Its opening the printable list in new pop up window. 它在新的弹出窗口中打开可打印列表。
function openPrint() {
window.open("<?= $_SERVER["PHP_SELF"]; ?>?<?=$qstring?>&print=true","","width=1024,height=600,menubar=yes,resizable=yes, scrollbars=yes");
}
I am in need to use the above select checkbox and it should show the selected print list in the pop up ? 我需要使用上面的选择复选框,它应该在弹出窗口中显示选定的打印列表吗?
I hope it should not be problem any1 to understand it. 我希望理解它不会成为问题。 Any help ? 有什么帮助吗?
Currently you have defined button onclick event , instead of this set onclick event on checkbox. 当前,您已定义按钮onclick事件,而不是在复选框上设置此onclick事件。
<input type='checkbox' name="ChkS[]" value='<? echo $rs->id?>' onClick="openPrint();">
Hope this will help you to solve your problem. 希望这可以帮助您解决问题。
Javascript Modification: JavaScript修改:
var s = "";
function changeval(value) {
s = value;
}
function openPrint() {
alert(s);
window.open("<?= $_SERVER["PHP_SELF"]; ?>?<?=$qstring?>&print=true","","width=1024,height=600,menubar=yes,resizable=yes, scrollbars=yes");
}
HTML Modification: HTML修改:
<input type='checkbox' name="ChkS[]" value='<? echo $rs->id?>' onchange="changeval(this.value)" />
What I have done? 我做了什么?
Created an Global Variable s
. 创建了一个全局变量s
。
Attached or Bind onchange
event on checkbox and set the value of Variable s
according. 在复选框上附加或绑定onchange
事件,并根据设置Variable s
值。
Now, You have variable s
with value, you just have to use it in any function. 现在,您有了带有值的变量s
,您只需要在任何函数中使用它即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.