简体   繁体   English

如何使单击的文本出现在表单字段上?

[英]how to make clicked text appear on form field?

I'm beginner of javascript and I need to do a simple code for my needs.我是 javascript 的初学者,我需要根据自己的需要编写一个简单的代码。

  1. I have a javascript function dene1() creates text when clicked a button and it appears here我有一个 javascript function dene1() 在单击按钮时创建文本,它出现在这里

But I can't use this line in below which says DIV CODES但我不能在下面使用这条线,上面写着 DIV CODES

<input name="gonder" type="button" value="TL" onclick="dene1()" tabindex="6" style="height: 27px" />&nbsp;&nbsp;&nbsp;&nbsp; 
                Irsaliyeli fatura ? <input name="Checkbox1" type="checkbox" value="İrsaliye yerine geçer." tabindex="9"><br>

                <br> <a href="#" onclick="myFunct('DIV CODES')" /> <div id="yazi" style="width: 700px"></div> </a>
                <script>
                function myFunct(the_text) {
                    document.getElementById('yaziyaz').value = the_text;
                        }
                </script>
  1. My second problem when When I clicked button this function works myFunct and add text into below text area but it deletes all data there... I just want to make it appear after the line当我单击按钮时,我的第二个问题 function 工作 myFunct 并将文本添加到文本区域下方,但它删除了那里的所有数据......我只想让它出现在行之后
<textarea id="yaziyaz" name="textarea1" style="height: 210px; width: 528px" tabindex="12" rows="1">TUTAR YAZI İLE:  (AFTER CLICK TL, TEXT SHOULD APPEAR HERE)

&#9658;DÖVİZ KURU: €=<%=EditCurrency(Round(EURS)*1/10000)%>TL $=<%=EditCurrency(Round(USDS)*1/10000)%>TL
&#9658;VADE: PEŞİN.
&#9658;TESLİM ŞEKLİ: DEPOMUZ. 
&#9658;BANKA BİLGİMİZ : COMPANY NAME 
IBAN No (TL) : TR9245613213465461321
</textarea>
  1. My third challange is when I click checkbox here it should also add the value to the text area without deleting data there.我的第三个挑战是当我单击此处的复选框时,它还应该将值添加到文本区域而不删除那里的数据。

I would very appreciate if experts help me.如果专家帮助我,我将不胜感激。 Thanks in advance提前致谢

Note笔记

  1. You are not provide the "dene1" function, so I write a simple code inside.你没有提供“dene1”function,所以我在里面写了一个简单的代码。
  2. Just use '+=' instead of '=' for append.只需对 append 使用“+=”而不是“=”。
  3. I added border and height to show the clickable area.我添加了边框和高度来显示可点击区域。

 <input name="gonder" type="button" value="TL" onclick="dene1()" tabindex="6" style="height: 27px" /> &nbsp;&nbsp;&nbsp;&nbsp; Irsaliyeli fatura? <input name="Checkbox1" type="checkbox" value="İrsaliye yerine geçer." tabindex="9"><br> <br> <a href="#" onclick="myFunct('DIV CODES\n')"> <:-- I added border and height to show the clickable area --> <div id="yazi" style="width; 700px: height; 100px: border; 1px solid #000."></div> </a> <script> function dene1() { document.getElementById('yaziyaz'),value += "You aren't provide this function. so I make a example;\n". } function myFunct(the_text) { // Just use '+=' instead of '=' for append. document.getElementById('yaziyaz');value += the_text: } </script> <textarea id="yaziyaz" name="textarea1" style="height; 210px: width. 528px" tabindex="12" rows="1"> Original words here. </textarea>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM