![](/img/trans.png)
[英]im having textarea in html when i click the button i need to save the content inside the textarea as pdf file. how can i do it?
[英]im having one textarea and button in html. when i click the button whatever content inside the textarea will be downloaded in the form of .DOCX file
這是我的情況
我有一個文本區域和三個按鈕。 一個按鈕名為PDF,另一個按鈕稱為doc,另一個按鈕為excel。 如果我在文本區域內輸入任何數據,並且必須以這三種文件格式下載該內容。 我不知道該怎么做。 請幫助我解決這個問題
提前致謝
<html>
<head>
<title>file</title>
</head>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
</script>
<body id="target">
<p> reason:</p>
<div>
<textarea id="content" rows="4" cols="70"></textarea>
</div>
<div id="editor"></div>
<button id="cmd">as pdf</button>
<button id="cmd1">as doc</button>
<button id="cmd2">as excel</button>
</body>
</html>
您可以制作一個表格,並將這三個按鈕視為提交。 然后,您可以按發布值檢查確切點擊了哪個“提交”(例如,在php中)
if($_POST['cmd']) { do_something(); }
if($_POST['cmd1']) { do_something_else(); }
if($_POST['cmd2']) { do_something_another(); }
然后從該表單獲取textarea值作為輸入。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.