熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

UBB編輯器原來就這麼簡單

2022-06-13   來源: JSP教程 
<script>
/*
 * 功能UBB編輯控制函數
 * 參數: tag 為標簽名稱 val 為標簽參數
 * 返回[標簽名稱=參數]修飾文字[/標簽名稱]
 *       [標簽名稱]修飾文字[/標簽名稱]
 *       [標簽名稱=參數][/標簽名稱]
 */
function ubbaction(tag val){
 var tag = tagtoUpperCase();
 if(typeof(val) == undefined){
  val = ;
 }
 if(val){
  val = = + val;
 }
 
 var r = documentselectioncreateRange()text;
 if(tag == URL){
  val = prompt(請輸入連接地址:(留空為選定地址) //);
 if(val !=  // && val != ){
  val = = + val;
 }else{
  val = ;
 }
 }
 if(tag == MAIL){
  val = prompt(請輸入郵箱地址:(留空為選定地址) );
 if(val != ){
  val = = + val;
 }
 }
 rr = [ + tag + val + ] + r + [/ + tag +];
 if(r){
  documentselectioncreateRange()text = rr;
 }else{
  ntentvalue += rr;
 }
}
</script>
<form name=form method=post action=>
  <input type=button name=Submit value=B onClick=ubbaction(B)>
  <input type=button name=Submit value=I onClick=ubbaction(I)>
  <input type=button name=Submit value=U onClick=ubbaction(U)>
  <select name=ffont onChange=ubbaction(FONT thisoptions[thisselectedIndex]value); thisvalue = ;>
    <option value=>FONT</option>
    <option value=Arial style=fontfamily:Arial>Arial</option>
    <option value=Times style=fontfamily:Times>Times</option>
    <option value=Courier style=fontfamily:Courier>Courier</option>
    <option value=Impact style=fontfamily:Impact>Impact</option>
    <option value=Geneva style=fontfamily:Geneva>Geneva</option>
    <option value=Optima style=fontfamily:Optima>Optima</option>
  </select>
  <select name=fsize onChange=ubbaction(SIZE thisoptions[thisselectedIndex]value); thisvalue = ;>
    <option value=>SIZE</option>
    <option value=>Small</option>
    <option value=>Large</option>
    <option value=>Largest</option>
  </select>
  <select name=fcolor onChange=ubbaction(COLOR thisoptions[thisselectedIndex]value); thisvalue = ;>
    <option value=>COLOR</option>
    <option value=black >Black</option>
    <option value=red >Red</option>
    <option value=yellow >Yellow</option>
    <option value=pink >Pink</option>
    <option value=green >Green</option>
    <option value=orange >Orange</option>
    <option value=purple >Purple</option>
    <option value=blue >Blue</option>
    <option value=beige >Beige</option>
    <option value=brown >Brown</option>
    <option value=teal >Teal</option>
    <option value=navy >Navy</option>
    <option value=maroon >Maroon</option>
    <option value=limegreen >LimeGreen</option>
  </select>
  <br>
<input type=button name=Submit value=URL onClick=ubbaction(URL)>
  <input type=button name=Submit value=IMG onClick=ubbaction(IMG)>
  <input type=button name=Submit value=CODE onClick=ubbaction(CODE)>
  <input type=button name=Submit value=MAIL onClick=ubbaction(MAIL)>
  <input type=button name=Submit value=QUOTE onClick=ubbaction(QUOTE)>
  <input type=button name=Submit value=LIST onClick=ubbaction(LIST)>
 <br>
  <textarea name=content cols= rows= id=content></textarea>
  <input type=submit name=Submit value=提交>
</form>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19640.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.