<thead id="jxdzp"><address id="jxdzp"><pre id="jxdzp"></pre></address></thead>

<em id="jxdzp"><span id="jxdzp"></span></em>

    <listing id="jxdzp"><nobr id="jxdzp"><meter id="jxdzp"></meter></nobr></listing>

      <address id="jxdzp"></address>
      <noframes id="jxdzp"><form id="jxdzp"><th id="jxdzp"></th></form>
      <noframes id="jxdzp"><form id="jxdzp"><th id="jxdzp"></th></form>

          訂閱本欄目 RSS您所在的位置: 深山工作室 > HTML > 正文

          一個運行HTML文件的代碼

          網頁教學網 2008/3/19 20:40:55 深山行者 字體: 瀏覽 8773

          以下是引用片段:

          <style type="text/css">
          <!--
          .sumit1 {width:98%;height:100%;background:#FFFFFF;border:1px solid red;color:red;font-weight:bold;font-size:14px;}
          .sumit2 {width:98%;height:100%;background:#FFFFFF;border:1px solid green;color:green;font-weight:bold;font-size:14px;}
          .sumit3 {width:98%;height:100%;background:#FFFFFF;border:1px solid blue;color:blue;font-weight:bold;font-size:14px;}
          .sumit4 {width:98%;height:100%;background:#FFFFFF;border:1px solid #000;color:#000;font-weight:bold;font-size:14px;}
          .sumit5 {width:98%;height:100%;background:#FFFFFF;border:1px solid blue;color:blue;font-weight:bold;font-size:14px;}
          .sumit6 {width:98%;height:100%;background:#FFFFFF;border:1px solid #000;color:#000;font-weight:bold;font-size:14px;}
          -->
          </style>
          <script>
          //獲取一個對象
          function getByid(id) {
           if (document.getElementById) {
            return document.getElementById(id);
           } else if (document.all) {
            return document.all[id];
           } else if (document.layers) {
            return document.layers[id];
           } else {
            return null;
           }
          }


          //運行框操作
          function creatID(DivID){
          var objs=getByid(DivID).getElementsByTagName('textarea');
          var inps=getByid(DivID).getElementsByTagName('input');
          var buts=getByid(DivID).getElementsByTagName('button');
          var labs=getByid(DivID).getElementsByTagName('label');
           for (i=0; i<objs.length; i++) {
            objs[i].id="runcode"+i;
            inps[i].id=i
            buts[i].id=i
            labs[i].id=i
           }
          }
          function runCode(obj){  //定義一個運行代碼的函數,
             var code=getByid("runcode"+obj).value;//即要運行的代碼。
             var newwin=window.open('','','');  //打開一個窗口并賦給變量newwin。
             newwin.opener = null // 防止代碼對論談頁面修改
             newwin.document.write(code);  //向這個打開的窗口中寫入代碼code,這樣就實現了運行代碼功能。
             newwin.document.close();
          }

          //復制代碼
          function doCopy(obj) {
           if (document.all){
             textRange = getByid("runcode"+obj).createTextRange();
             textRange.execCommand("Copy");
             alert("代碼已經復制到剪切板");
           }else{
             alert("此功能只能在IE上有效\n\n請在文本域中用Ctrl+A選擇再復制")
           }
          }
          //另存代碼
          function saveCode(obj) {
                  var winname = window.open('','','width=0,height=0,top=200,left=200px');
                  winname.document.open('text/html', 'replace');
                  winname.document.write(obj.value);
                  winname.document.execCommand('saveas','','純CSS簡潔TAB.html');
                  winname.close();
          }

          //剪切代碼
          function cut(obj) {
           if (document.all){
             textRange = getByid("runcode"+obj).createTextRange();
             textRange.execCommand("cut");
             alert("代碼已經剪切到剪切板");
           }else{
             alert("此功能只能在IE上有效\n\n請在文本域中用Ctrl+A選擇再剪切")
           }
          }

          //粘貼代碼
          function paste(obj) {
           if (document.all){
             textRange = getByid("runcode"+obj).createTextRange();
             textRange.execCommand("paste");
             alert("粘貼代碼");
           }else{
             alert("此功能只能在IE上有效\n\n請在文本域中用Ctrl+v選擇再粘貼")
           }
          }
          </script>

           <table width="100%" border="0" cellpadding="0" cellspacing="0">
           <form name=form1>
             <tr>
               <td height="530" colspan="6"><textarea name="text" id="runcode0" cols="72" rows="9" style="width:100%;height:98%;"> </TEXTAREA></td>
              </tr>
             <tr>
               <td height="53"><input type="button" value="運行代碼" id="0" onClick="runCode(this.id)" class="sumit1"></td>
               <td><input type="button" value="保存代碼" id="0" onClick="saveCode(runcode0)" class="sumit2"></td>
               <td><input type="button" value="復制代碼" id="0" onClick="doCopy(this.id)" class="sumit3"></td>
               <td><input type="button" value="剪切代碼" id="0" onClick="cut(this.id)" class="sumit4"></td>
               <td><input type="button" value="粘貼代碼" id="0" onClick="paste(this.id)" class="sumit5"></td>
               <td><input type="button" value="清空代碼" id="0" onClick="document.form1.text.value='';" class="sumit6"></td>
             </tr>
            </form>
           </table>
           

           

           

           


          相關閱讀
          jquery中動態生成的代碼使用on hover事件時不出現效果
          給個photoshopcs下載地址,大家可能用到
          uni-app基礎知識數組形式的數據綁定
          ASP 格式化顯示時間為幾個月,幾天前,幾小時前,幾分鐘前,或幾秒前
          振輝自清洗過濾器
          烏魯木齊旅游
          2012-3-22中午的一件電話事件(一個不懂怎么定義的電話)(備份)
          input文本輸入框只能輸入數字或字母或漢字等
          共有0條關于《一個運行HTML文件的代碼》的評論
          發表評論
          正在加載評論......
          返回頂部發表評論
          呢 稱:
          表 情:
          內 容:
          評論內容:不能超過 1000 字,需審核,請自覺遵守互聯網相關政策法規。
          驗證碼: 驗證碼 
          網友評論聲明,請自覺遵守互聯網相關政策法規。

          您發布的評論即表示同意遵守以下條款:
          一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會、集體和公民的合法權益;
          二、不得發布國家法律、法規明令禁止的內容;互相尊重,對自己在本站的言論和行為負責;
          三、本站對您所發布內容擁有處置權。

          更多信息>>欄目類別選擇
          百度小程序開發
          微信小程序開發
          微信公眾號開發
          uni-app
          asp函數庫
          ASP
          DIV+CSS
          HTML
          python
          更多>>同類信息
          dw里面查找替換使用正則刪除sqlserver里面的CONSTRAINT
          javascript獲取瀏覽器指紋可以用來做投票
          火狐Mozilla Firefox出現:無法載入您的Firefox配置文件 它可能已經丟失 或是無法訪問 問題解決集合處理辦法
          DW設置之后更好用 DreamweaverCS編輯GB2312與UTF-8文件在代碼視圖中點擊鼠標錯位問題的解決辦法
          js指定日期加n天加n月加n年
          jquery中動態生成的代碼使用on hover事件時不出現效果
          更多>>最新添加文章
          dw里面查找替換使用正則刪除sqlserver里面的CONSTRAINT
          Android移動端自動化測試:使用UIAutomatorViewer與Selenium定位元素
          抖音直播音掛載小雪花 懂車帝小程序
          javascript獲取瀏覽器指紋可以用來做投票
          火狐Mozilla Firefox出現:無法載入您的Firefox配置文件 它可能已經丟失 或是無法訪問 問題解決集合處理辦法
          在Android、iOS、Windows、MacOS中微信小程序的文件存放路徑
          python通過代碼修改pip下載源讓下載庫飛起
          python里面requests.post返回的res.text還有其它的嗎
          更多>>隨機抽取信息
          asp論壇制作教程(二)——asp論壇制作文件關系發析
          asp正則表達式詳細
          通過阿里云服務接口獲得ip地址詳細信息
          一個利用radio單選選擇框進行變色的網頁效果
          設置兩個未知高度的DIV保持等高
          長春海外旅行社
          88国产精品视频一区二区三区