DHTMLX Docs & Samples Explorer

### Viewport as an Existing Object

In this case dhtmlxWindows will use the existing object
on page as a viewport. This type of a viewport is used
to make elements in it selectable.
By default the viewport has no border. In our samples
we showed the border to specify the boundaries
in which the window is displayed on page,
i.e. we visualised the viewport.
The Dead Zone is a 1983 horror film/Thriller film based on the Stephen King novel of the same name. Directed by David Cronenberg, the film stars Christopher Walken, Tom Skerritt, Herbert Lom, Brooke Adams, and Colleen Dewhurst. The plot revolves around a schoolteacher, Johnny Smith (Walken), who awakens from a coma to find he has psychic powers.
Johnny Smith (Walken) is a young New England schoolteacher in love with his colleague Sarah (Adams) when he is involved in a serious car accident that sends him into a coma. He awakes under the care of neurologist Dr. Weizak (Lom) and counts himself fortunate when he notes no casts, bandages or visible signs of injuries on his body. However, the awakening turns rude when he is told that five years have passed since he last knew consciousness: his girlfriend has long since married and had a child.
Johnny's transition back to life is made rougher when he discovers that he has the ability to learn a person's secrets (past, present, future) through making physical contact with the person.
After reluctantly using his ability to help a local sheriff (Skerritt) solve a series of brutal rape-murders, Johnny attempts to resume his profession, as a private tutor. However, his ability continues to haunt him, especially when he foresees that a rising local political star, Greg Stillson (Sheen), will someday be elected President of the United States, with disastrous consequences - in John's vision, Stillson starts a nuclear holocaust, presumably destroying all of civilization.
Johnny decides to avert this possible future by shooting Stillson at a meeting. He misses and winds up mortally wounded, but he has nonetheless accomplished his mission. During the shooting, the terrified Stillson grabbed a baby to use as a human shield. A photographer covering the meeting got a picture of this cowardly act and ran out before Stillson's security could stop him. Stillson goes to the dying Johnny, demanding to know who sent him. Johnny touches Stillson, and receives one final vision -- that of a haggard Stillson, ruined as a result of the scandal, killing himself. "You're finished," he tells the politician.
Source

    <link rel="stylesheet" type="text/css" href="../../codebase/dhtmlxwindows.css">
    <link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxwindows_dhx_skyblue.css">
    <script src="../../codebase/dhtmlxcommon.js"></script>
    <script src="../../codebase/dhtmlxwindows.js"></script>

    <script src="../../codebase/dhtmlxcontainer.js"></script>

    <div id="vp_container" style="height: 400px; width: 800px;">
    In this case dhtmlxWindows will use the existing object
    <br>
    on page as a viewport. This type of a viewport is used
    <br>
    to make elements in it selectable.
    <br>
    <br>
    By default the viewport has no border. In our samples
    <br>
    we showed the border to specify the boundaries
    <br>
    in which the window is displayed on page,
    <br>
    i.e. we visualised the viewport.
    <br>
    <br>
    <br>
    <input type="text" value="check input">
    <input type="button" value="click me">
    <select><option>select</option></select>
    <div id="obj" style="font-family: Tahoma; font-size: 10px; height: 100%; overflow: auto;">
        <div style="margin: 4px;">
        The Dead Zone is a 1983 horror film/Thriller film based on the Stephen King novel of the same name. Directed by David Cronenberg, the film stars Christopher Walken, Tom Skerritt, Herbert Lom, Brooke Adams, and Colleen Dewhurst. The plot revolves around a schoolteacher, Johnny Smith (Walken), who awakens from a coma to find he has psychic powers.
        <br><br>
        Johnny Smith (Walken) is a young New England schoolteacher in love with his colleague Sarah (Adams) when he is involved in a serious car accident that sends him into a coma. He awakes under the care of neurologist Dr. Weizak (Lom) and counts himself fortunate when he notes no casts, bandages or visible signs of injuries on his body. However, the awakening turns rude when he is told that five years have passed since he last knew consciousness: his girlfriend has long since married and had a child.
        <br><br>
        Johnny's transition back to life is made rougher when he discovers that he has the ability to learn a person's secrets (past, present, future) through making physical contact with the person.
        <br><br>
        After reluctantly using his ability to help a local sheriff (Skerritt) solve a series of brutal rape-murders, Johnny attempts to resume his profession, as a private tutor. However, his ability continues to haunt him, especially when he foresees that a rising local political star, Greg Stillson (Sheen), will someday be elected President of the United States, with disastrous consequences - in John's vision, Stillson starts a nuclear holocaust, presumably destroying all of civilization.
        <br><br>
        Johnny decides to avert this possible future by shooting Stillson at a meeting. He misses and winds up mortally wounded, but he has nonetheless accomplished his mission. During the shooting, the terrified Stillson grabbed a baby to use as a human shield. A photographer covering the meeting got a picture of this cowardly act and ran out before Stillson's security could stop him. Stillson goes to the dying Johnny, demanding to know who sent him. Johnny touches Stillson, and receives one final vision -- that of a haggard Stillson, ruined as a result of the scandal, killing himself. "You're finished," he tells the politician.
        </div>
    </div>
    </div>

    <br>
    <script>var dhxWins,
    w1;
    function doOnLoad() {
        dhxWins = new dhtmlXWindows();
        dhxWins.enableAutoViewport(false);
        dhxWins.attachViewportTo("vp_container");
        dhxWins.vp.style.border = "#909090 1px solid";
        dhxWins.setImagePath("../../codebase/imgs/");
        w1 = dhxWins.createWindow("w1", 340, 20, 320, 240);
        w1.setText("dhtmlxWindow");
        w1.button("close").disable();
        w1.attachObject('obj');
    }</script>