The underlying data, be it for game world or the webpage (HTML) contains objects/elements - characters, items, structures - or in case of webpage, elements - DIVs (boxes) and SPANs (marked spans of text
All these have various properties attached to them - looks, textures, locations, shapes, behaviors, content data, audio data, whatever makes them unique. Amongst these properties they have triggers (a.k.a. events - when something happens to the object, e.g. user hovers the cursor over it, or click it, or a clock countdown reaches zero...) and the triggers have scripts attached to them.
Now the engine - be that the web browser or a game program takes that data and renders it. Whether it's deciding a piece of text found between marks
<strike>...</strike> should be rendered like
this or whether following the definition of texture and vector model a tree should be set in game environment, this is something the user will see.
Now, if the user performs an action - say, click the tree while the character is holding an axe, or click a box on the page, if there's an event defined for that action, the browser will pass the script attached to the event to its internal scripting engine and execute it as a program. Then the script may affect other objects, like add an object "piece of wood" to the player's character inventory, or open a help box in the page.
There's of course one special object - the world, or in case of webpages the document, and it can have events attached too - especially "finished loading" event, to which a whole bunch of scripts is being attached and they start just then. (there's some more caveats with that but let's keep this simple now). This, in case of WWW often performs the job of getting all other kinds of events attached to the rest of the webpage, and all different kinds of tasks.
Summing up: you have data (game data or webpage) and renderer (browser or game engine). It displays the data and performs generic actions with it, also observing events. All objects in the data can have events attached to them, and scripts attached to the events. When event occurs, engine loads up and executes the script.
And as for interface, the webpage or the game world is the environment and the language has features to interface with that environment, e.g. modify properties of other objects, create their instances or delete them.