Browser support:
Sets or retrieves the space between frames in pixels.
Syntax:
This property is read/write.
Possible values:
String that sets or retrieves the space between frames with an integer, optionally followed by a 'px' (pixel) unit designator.
Default: 2 .
Example HTML code 1:
This example illustrates the use of the frameSpacing attribute:
Code
topFrame.htm
mainFrame.htm
< frameset rows = "*" cols = "200, *" framespacing = "30" >
< frame src = "topFrame.htm" name = "topFrame" scrolling = "No" />
< frame src = "mainFrame.htm" name = "mainFrame" />
</ frameset >
< !DOCTYPE html >
< html >
< head >
< meta charset = "utf-8" />
</ head >
< body >
< h1 > Contents of the top frame </ h1 >
May contain menu items or a logo.
</ body >
</ html >
< !DOCTYPE html >
< html >
< head >
< meta charset = "utf-8" />
< script type = "text/javascript" >
function AddRow (statTable, element, attr, attrValue) {
if (attrValue == null )
attrValue = element. getAttribute (attr);
var row = document . createElement ( "tr" );
var nameCell = document . createElement ( "td" );
var valueCell = document . createElement ( "td" );
nameCell. innerHTML = attr;
valueCell. innerHTML = attrValue;
row. appendChild (nameCell);
row. appendChild (valueCell);
statTable. appendChild (row);
}
function CreateFramesetStat () {
var statTable = document . getElementById ( "frameset_stat" );
var frameSet = window . frameElement . parentNode ;
AddRow (statTable, frameSet, "border" );
AddRow (statTable, frameSet, "borderColor" );
AddRow (statTable, frameSet, "frameBorder" );
AddRow (statTable, frameSet, "frameSpacing" );
AddRow (statTable, frameSet, "cols" );
AddRow (statTable, frameSet, "rows" );
}
function CreateTopFrameStat () {
var statTable = document . getElementById ( "topframe_stat" );
var frame = parent . frames [ 'topFrame' ]. frameElement ;
AddRow (statTable, frame, "noResize" , frame. noResize );
AddRow (statTable, frame, "scrolling" );
}
function CreateMainFrameStat () {
var statTable = document . getElementById ( "mainframe_stat" );
var frame = window . frameElement ;
AddRow (statTable, frame, "noResize" , frame. noResize );
AddRow (statTable, frame, "scrolling" );
}
function CreateStat () {
CreateFramesetStat ();
CreateTopFrameStat ();
CreateMainFrameStat ();
}
</ script >
</ head >
< body onload = "CreateStat ()" >
< table >
< thead >
< tr >
< th > Frameset </ th >
< th > Top frame </ th >
< th > Main frame </ th >
</ tr >
</ thead >
< tbody >
< tr >
< td valign = "top" >
< table border = "1px" cellspacing = "2px" >
< thead >
< tr >
< th > name </ th >
< th > value </ th >
</ tr >
</ thead >
< tbody id = "frameset_stat" >
</ tbody >
</ table >
</ td >
< td valign = "top" >
< table border = "1px" cellspacing = "2px" >
< thead >
< tr >
< th > name </ th >
< th > value </ th >
</ tr >
</ thead >
< tbody id = "topframe_stat" >
</ tbody >
</ table >
</ td >
< td valign = "top" >
< table border = "1px" cellspacing = "2px" >
< thead >
< tr >
< th > name </ th >
< th > value </ th >
</ tr >
</ thead >
< tbody id = "mainframe_stat" >
</ tbody >
</ table >
</ td >
</ tr >
</ tbody >
</ table >
</ body >
</ html >
Did you find this example helpful?
yes
no
Example HTML code 2:
You can get the frameSpacing property of the frameset from one of its frames. The code below shows how to implement it.
< script type = "text/javascript" >
function GetFramesetFrameSpacing () {
var frameSet = window . frameElement . parentNode ;
return frameSet. frameSpacing ;
}
</ script >
Did you find this example helpful?
yes
no
Related pages:
External links:
Share:
Digg
Del.icio.us
Reddit
Facebook
Twitter
Diigo
User Contributed Comments