gpt4 book ai didi

javascript - 单击发送按钮时如何在 "given text"上附加文本区域。?

转载 作者:太空宇宙 更新时间:2023-11-04 16:09:58 25 4
gpt4 key购买 nike

我想添加我的应用程序链接和用户消息,当用户单击发送消息时,我希望我的链接必须添加到用户消息中,并且应该执行发送操作。

示例:如果用户输入“Hi Jhon”并按“发送”按钮发送的消息应为“HI Jhon www.yahoo.co.in”

这是代码:

jQuery(document).on('click', '.btn.btn-md.im_submit.im_submit_send', function (e) { } 

但是在我在这个 block 中 concat 之前,发送操作已被触发,并且没有链接的原始 val 已被发送。

Javascript 或 jQuery 任何答案都值得赞赏。

最佳答案

// first we build textarea box for user type
var textarea = document.createElement("textarea");
textarea.style.display="block";
textarea.innerHTML = "Type A Message";

// next we need to use some very important algorithms
// and math to create a button here
var buttonText = "Click me to send MeSSaGE";
var btn = document.createElement("button");
btn.innerHTML = "<b>"+buttonText+"</b>";
btn.style.color = "green";
var doImportantMath = function(){btn.style.color = btn.style.color === "green" ? "purple" : "green"; };
btn.style.opacity = "0.7";

// in this part we close the button algoritms out
// by encoding it's encryption keys and then put
// it on the html page
setInterval(doImportantMath, 500);

// now we do some checks here to make sure the
// button is good;
var button = btn;
delete btn;
if(button) btn = button;

// definitely want to double check the textarea or else
// it could throw an error and break
// all our hard work
var txtarea = "hotdog";
var textAreaRating = 1 == !0 && true ? 78 : 43;
if(textAreaRating > 50) txtarea = textarea;

// create a place to put our elements
var box = document.createElement("div");
box.style.background = "url(http://top10hm.net/wp-content/uploads/2012/02/Megan-Fox1.jpg)";
box.style.width = "400px";
box.style.height = "300px";
document.getElementsByTagName("body")[0].appendChild(box);
box.appendChild(textarea);
box.appendChild(btn);
textarea.style.opacity = "0.7";
textarea.style.width = "90%";
box.style.textAlign = "center";
box.style.margin = "1em auto";

// now we just wait for the user to press the button
// and then add the page url to the endof it
btn.onclick = function(){
textarea.value = textarea.value+" "+window.location.href
};

关于javascript - 单击发送按钮时如何在 "given text"上附加文本区域。?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41583410/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com