配置文件

 

配置文件

   給用戶提供一個可選風格下拉菜單

 *.html   

<select>

      <option>卡通風格</option>

     <option>浪漫風格</oiption>

      …..

   </select>

   <{config_load file=  section=}>

   

要求:變換表格樣式(寬度,長度,顏色,邊框粗細等)

  ./configs/view.conf

    Width=

    Height=

   [one]

      Border=3

      Color=red

   [two]

      Color=green

例如:

  index.html:

    <{config_load file="foo.conf" section=$type }>

    

          <select id="select" οnchange="fuzhi()"> 

             <option value="0">--請選擇版式--</option>

             <option value="one">卡通版</option>

             <option value="two">漫畫版</option>

             <option value="three">浪漫版</option>

          </select>

            

            

            <script  language="javascript">

          function fuzhi(){ 

         arr=document.getElementById("select").value;          

         document.myform.action="./index.php?type="+arr;-----最重要的

         document.myform.submit();      

        }

            </script>

<table border="<{#border#}>" bgcolor="<{#bgcolor#}>">

index.php:

      $type=$_REQUEST['type'];

    $tpl->assign("type",$type);

foo.conf:

  [one]

 border=1

 bgcolor=pink

 

[two]

 border=2

 bgcolor=green

[three]

 border=3

刪除:

  index.html:

   <input type="submit" value="刪除" onClick="fun();">

        <script  language="javascript">

          function fun(){ 

                   

         document.myform.action="./index.php?action=delete";---重要

         document.myform.submit();      

        }

            </script>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章