HTML DOM id attribute
Definition and Usage
The id attribute can be set or returned for the frameset.
Syntax
framesetObject.id = id
Example
In our example, the first step is to create an HTML document containing a frameset with two columns. Each column is set to 50% of the browser window:
<html> <frameset id="main" cols="50%,50%"> <frame id="leftFrame" src="frame_frameset_id.htm"> <frame id="rightFrame" src="frame_a.htm" > </frameset> </html>
The HTML document "frame_frameset_id.htm" is placed in the first column, while the HTML document "frame_a.htm" is placed in the second column.
Below is the source code of "frame_frameset_id.htm":
<html>
<head>
<script type="text/javascript">
function showFrameId()
{
var txt="Frameset Id: "
txt=txt + parent.document.getElementById("main").id
alert(txt)
}
</script>
</head>
<body>
<input type="button" onclick="showFrameId()"
value="Show Frameset Id" />
</body>
</html>