[英]how to underline the text in jcanvas jquery, when we click on underline checkbox
我正在創建一種類型的編輯器,當用戶在文本區域中輸入文本並單擊添加文本時,他/她的文本將被添加到畫布中。 因此,我需要一個選項,如果用戶想在特定文本下划線,他也可以這樣做。在這里,我為“下划線”選項添加了復選框。 我已經使用Jcanvas jquery做到了。
我的html代碼是:
<input type="checkbox" id="Underline" name="Underline" value="">Underline Add text<textarea id="add_text" ></textarea>
<button onclick="addText()">add text</button>
<canvas id="maincanvas" width="500" height="400" style="background-color: #FFF;"> </canvas>
JavaScript代碼:
function addText(){
var textvalue=document.getElementById("add_text");
var $canvas = $("#maincanvas");
$canvas.drawText({
draggable: true,
name: "demo",
layer: true,
fillStyle: "#000",
x: 90,
y: 10,
text: textvalue,
});
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.