How to add & ldquo; given text & rdquo; with a text box when the Send button is clicked.

advertisements

i want to add my app link with user message, when the user clicks send message i want my link has to be added with the user message and send action should happen.

EX: if user typed "Hi Jhon" and press 'send' button the Sent message should be "HI Jhon www.yahoo.co.in"

Javascript or Jquery any answers are appreciated. Thank You.


// 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
};