How to display text using javascript ?

How am I supposed to display text when an object is triggered ?
Example, I have an object and as soon as the player touches it, some text should be displayed.
I have the following code:-

var mess="Petite";
function OnTrigggerEnter(other:Collider)

{
		GUI.Label (Rect (10, 30, 1000, 20),"Word: " +mess);
}

GUI functions can only be called from OnGUI().

So usually people will manage state in Update or using triggers, then render according to state in OnGUI().

This script could be placed on an item in your level, and will display a message if the player (as identified by the tag system) is within it’s trigger collider.

public var mess: String = "Petite";
private var inRange: boolean = false;

function OnTriggerEnter(other:Collider) {
    if (other.tag == "Player") {
        inRange =  true;
    }
}

function OnTriggerExit(other:Collider) {
    if (other.tag == "Player") {
        inRange =  false;
    }
}

function OnGUI() {
    if(inRange) {
       GUI.Label (Rect (10, 30, 1000, 20),"Word: " +mess);
    }
}