Home > Net >  Js print styles
Js print styles

Time:10-02

The function bindData () {

//if the checkbox, radio, select> A change in the value of the option, binding, too, to ignore button here
$(" input, select the option ".) each (function () {
$(this). Attr (' value '$(this). Val ());
});

$(" input [type='text'] "). Each (function () {
$(this). The HTML ($(this). Val ());
});

//type=the checkbox, type=radio selected
$(" input [type='checkbox'], input [type='radio'] "). Each (function () {
If ($(this). Attr (" checked "))
$(this). Attr (" checked ", true);
The else
$(this). RemoveAttr (" checked ");
});

//select selected
$(" select the option ".) each (function () {
If ($(this). Attr (" selected "))
$(this). Attr (" selected ", true);
The else
$(this). RemoveAttr (" selected ");
});

//textarea
$(" textarea ".) each (function () {
$(this). The HTML ($(this). Val ());
});
}
The function printdiv (printpage) {

BindData ();
Var headstr="& lt; Html> <body> ";
Var footstr="& lt;/body> ";
Var newstr=document. All. The item (printpage). InnerHTML;
Var oldstr=document. The body. The innerHTML;
Document. The body. The innerHTML=headstr + newstr + footstr;
Window. The print ();
Document. The body. The innerHTML=oldstr;

return false;
}

CodePudding user response:

Recommend to use lodop print control

CodePudding user response:

This is what you mean what mean
  • Related