FlyPig

          if{}else if{}生活只有一個(gè)分支
          posts - 11, comments - 9, trackbacks - 0, articles - 4
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          今天做了一個(gè)例子,是在一個(gè)框架頁里面寫另外兩個(gè)框架頁的內(nèi)容,框架頁是這樣的:
          frame.html:

          <frameset?rows="15%,*"?cols="*"?framespacing="0"?frameborder="1"?id="out">
          ??
          <frame?src="top.html"?name="topFrame"?scrolling="no"?frameborder="1">
          ??
          <frameset?rows="*"?cols="20%,*"?framespacing="0"?frameborder="1"?id="in">
          ????
          <frame?src="left.html"?name="leftFrame"?scrolling="no"?>
          ????
          <frame?src="right.html"?name="rightFrame"?scrolling="no"?>
          ??
          frameset>
          frameset>

          ?

          其中top.html內(nèi)容是:

          <html>
          ??
          <head>tophead>
          ??
          <body?onLoad="alert('top?load?finish');">
          ??
          <script>

          ????function?writeFrame(frameName,content)
          {?
          ??????
          if(parent.frames[frameName].document?!=?null){
          ????????
          if(parent.frames[frameName].document.body?!=?null){
          ??????????parent.frames[frameName].document.body.innerHTML?
          =?content;
          ????????}
          else{
          ??????????window.setTimeout(
          "writeFrame('"+frameName+"','"+content+"')",1000);
          ????????}

          ??????}
          else{?
          ????????window.setTimeout(
          "writeFrame('"+frameName+"','"+content+"')",1000);
          ??????}

          ?????}


          ?????
          ?????function?writeFrameDirect(frameName,content)
          {
          ????????
          if(parent.frames[frameName].document?!=?null)
          ????????????
          if(parent.frames[frameName].document.body?!=?null)
          ????????????????parent.frames[frameName].document.body.innerHTML?
          =?content;
          ?????}


          ?????function?a()
          {
          ????????writeFrame(
          'leftFrame','top?write?left');?
          ????????writeFrame(
          'rightFrame','top?write?right');?
          ?????}


          ?????function?b()
          {
          ????????writeFrameDirect(
          'leftFrame','top?write?left');?
          ????????writeFrameDirect(
          'rightFrame','top?write?right');?
          ?????}


          ?????a();
          ?????
          //b();
          ??script>

          ??
          body>
          html>

          left.html內(nèi)容是:
          <html>
          ??
          <head>head>
          ??
          <body?onLoad="alert('left?load?finish');">
          ??
          body>
          html>

          ?

          right.html內(nèi)容是:

          <html>
          ??
          <head>head>
          ??
          <body?onLoad="alert('right?load?finish');">
          ??
          body>
          html>

          ?

          雖然明明框架頁onLoad的時(shí)候可以看出順序是:left,right,top.可是在top里面如果調(diào)用方法b()而不調(diào)用方法a(),那從top往left和right寫東西都是不起作用的.很奇怪哪.今天做一個(gè)菜單就是遇到這個(gè)問題.我要從top往left寫二級菜單的內(nèi)容,可是調(diào)用b()卻寫不成,還好寶玉教了我writeFrame的方法.用setTimeout定時(shí)去查left或right加載完畢沒,完畢后才寫.非常感謝他的幫助.


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 增城市| 什邡市| 海口市| 胶州市| 五原县| 禄丰县| 章丘市| 积石山| 双辽市| 长汀县| 晋宁县| 若羌县| 河津市| 巴马| 南丰县| 汶川县| 田阳县| 大足县| 章丘市| 平湖市| 青浦区| 东海县| 东乡族自治县| 宜阳县| 光泽县| 周至县| 唐河县| 永年县| 泸州市| 闽侯县| 海晏县| 泰兴市| 天门市| 教育| 天长市| 秭归县| 合阳县| 古交市| 金川县| 西宁市| 麻江县|