How do I add a send button to this code?

I need a send button to show up to the right of the input box. So it needs to say “username, input, and send”. right now it works with pressing enter but I am wanting to put it onto mobile so I need to add a send button. I have tried a few different things but I haven’t had much success.

#pragma strict
#pragma downcast

/*      testchat.js ( UnityScript )
 *                 
 *      2011  Lucian Games, LLC
 *
 *      Do whatever you want with this, at your own risk.
 */
 
//		a simple test chat using PubNub


import System;
import System.Collections.Generic;
import Parse;

var pubkey = 'demo';
var subkey = 'demo';
var secure = false;
var channel = 'simple_test_chat_for_unity3d';

var messages: SortedList.<Int64, String>;
var scrollpos: Vector2;
var input: String;
var username: String;
var newname: String;
var started = false;
var theFont: Font;
var lh = Screen.height/20; // label height

var nub: PubNub;


function Start(){
	username = LoginDetails.username;
	newname = username;
	messages = new SortedList.<Int64, String>();
	
	nub = new PubNub();
	nub.pubkey = pubkey;
	nub.subkey = subkey;
	nub.ssl = secure;
	
	yield StartCoroutine(nub.History( channel, 100, Hist ));
	StartCoroutine(nub.Subscribe( channel, Recv ));
}

function Hist( msgs: Array ){
	var i = msgs.length;
	for( var msg in msgs ){
		var ts: Int64 = i--;
		Recv( [ts, msg] );
	}
}

function FixedUpdate(){
	// trim messages
	while( messages.Count > 1024 ) messages.RemoveAt(0);
}

function Discard(thing){}

function _send( mt: MsgType, fields: Array ){
	var msg = protocol.Encode(mt, fields );
	StartCoroutine( nub.Publish(channel, msg, Discard) );
}

function Rename(){
	var msg: String;
	if( !started ) msg = newname + " has entered the chatroom";
	else msg = username + " changed his name to " + newname + ".";
	
	username = newname;
	_send( MsgType.announce, [ msg ] );
}

function Send( msg: String ){
	_send( MsgType.chat, [username, msg] );
	if(!started) started = true;
}

function Recv( args: Array ){
	var timestamp = args[0];
	var params: Array;
	
	try{ params = protocol.Decode( args[1] ); }
	catch(err){ Debug.Log(err); return; }
	
	var mt: MsgType = params[0];
	switch( mt ){
		case MsgType.chat:
			if( params.length != 3 ) return; // invalid message
			Chat( timestamp, params[1], params[2] );
			break;
		
		case MsgType.announce:
			if( params.length != 2 ) return; // invalid message
			Announce( timestamp, params[1] );
			break;
	}
	scrollpos.y = 9999;
}

function Chat( timestamp: Int64, user: String, msg: String ){
	messages.Add( timestamp, user + ' :  ' + msg );
}

function Announce( timestamp: Int64, msg ){
	messages.Add( timestamp, "System :  " + msg );
}

function OnGUI(){
	GUI.skin.font = theFont;
	
	// log
	GUILayout.BeginArea( Rect(0,Screen.height/2-32,Screen.width,Screen.height/2) );
	GUILayout.FlexibleSpace();
	
	scrollpos = GUILayout.BeginScrollView( scrollpos );
	for( var message: String in messages.Values ){
		GUILayout.Label( message );
	}
	
	GUILayout.EndScrollView();
	GUILayout.EndArea();
	
	// input
	GUILayout.BeginArea( Rect(0,Screen.height-lh,Screen.width,lh) );
	GUILayout.BeginHorizontal();
	
	if( Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return) ){
		switch( GUI.GetNameOfFocusedControl() ){
			case "input":
				if( newname != username ) Rename();
			
				Send(input);
				input = '';
				break;
			case "username":
				Rename();
				break;
		}
	}
	
	GUI.SetNextControlName("username");
	newname = GUILayout.TextField(newname, 25, GUILayout.Width(150), GUILayout.Height(lh));
	
	GUI.SetNextControlName("input");
	input = GUILayout.TextField(input, 1024, GUILayout.Height(lh));
	
	
	GUILayout.EndHorizontal();
	GUILayout.EndArea();
	
}

In your OnGUI() function you can add this to 1. create a button and 2. react to it being pressed:

if(GUI.Button(new Rect(topLeftX, topLeftY, buttonWidth, buttonHeight), buttonContent))
{
    // CODE: what ever is supposed to happen when the button is pressed
}

NOTE: “buttonContent” can either be an image or text.