若網頁中的頁面本身有iframe,而你在父網頁,想呼叫子網頁底下的javascript時可用contentWindow去呼叫
ex.
parent.document.getElementById("left").contentWindow.functionName();
若是子網頁要呼叫父網頁則直接用top或parent
ex.
若網頁中的頁面本身有iframe,而你在父網頁,想呼叫子網頁底下的javascript時可用contentWindow去呼叫
ex.
parent.document.getElementById("left").contentWindow.functionName();
若是子網頁要呼叫父網頁則直接用top或parent
ex.
//添加選項
function addOption(objId,text,val){//物件的id,文字,值
//根據id查找對象,
var obj = document.getElementById(objId);
var objOption = new Option(text,val);
function setCookie(c_name,c_value,days)//存入cookie的名稱,值,存活天數
{
var now = new Date( );
if(days == "" || days == null || days == undefined)//取未輸入預設為30天
now.setTime(now.getTime( ) + 1000 * 60 * 60 * 24 * 30);
取得目前螢幕的寬跟高,適用於ie及firefox
function getWinWidth ()
{
var mapFrameWidth = window.innerWidth;
if (mapFrameWidth == null || mapFrameWidth == 'undefined')