如何显示复选框和单选按钮以及html2canvas? [英] How to display checkbox and radiobuttons and with html2canvas?

查看:521
本文介绍了如何显示复选框和单选按钮以及html2canvas?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何显示复选框和单选按钮以及html2canvas?休息全部正确渲染..只有复选框和单选按钮的问题。

How to display checkbox and radiobuttons and with html2canvas? Rest all is rendering correctly..only problem with checkboxes and radiobuttons.

推荐答案

在html2canvas.js中进行以下更改。



案例INPUT:



if(/ ^(text | url | email | submit | button | reset | checkbox | radio)
In html2canvas.js plase make the following changes.

After case "INPUT":

if (/^(text|url|email|submit|button|reset|checkbox|radio)


/.test(element.type)&&(element.value || element.placeholder ||)。length> 0){

renderFormValue(元素,边界,堆栈);

}



el.nodeName ===SELECT之后



if(el.type =='checkbox'|| el.type =='radio'){

valueWrap.style.fontSize ='10px ';

valueWrap.style.lineHeight ='10px';

renderRect(stack.ctx,bounds.left-2,bounds.top-1,13,13, #888888);

renderRect(stack.ctx,bounds.left-1,bounds.top,11,11,#ddddd);

if( el.type =='复选框'){

textValue =(el.checked)? ✔:;

}

else if(el.type =='radio'){

textValue =(el。检查)? ●; :;

}
/.test(element.type) && (element.value || element.placeholder || "" ).length > 0) {
renderFormValue(element, bounds, stack);
}

After el.nodeName === "SELECT"

if (el.type == 'checkbox' || el.type == 'radio'){
valueWrap.style.fontSize = '10px';
valueWrap.style.lineHeight = '10px';
renderRect(stack.ctx, bounds.left-2, bounds.top-1, 13, 13, "#888888");
renderRect(stack.ctx, bounds.left-1, bounds.top, 11, 11, "#dddddd");
if(el.type == 'checkbox'){
textValue = (el.checked) ? "✔" : " ";
}
else if (el.type == 'radio'){
textValue = (el.checked) ? "●"; : " ";
}


这篇关于如何显示复选框和单选按钮以及html2canvas?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆