<script>
/*
* 功能
UBB編輯控制函數
* 參數: tag 為標簽名稱 val 為標簽參數
* 返回
[標簽名稱=參數]修飾文字[/標簽名稱]
* [標簽名稱]修飾文字[/標簽名稱]
* [標簽名稱=參數][/標簽名稱]
*/
function ubbaction(tag
val){
var tag = tag
toUpperCase();
if(typeof(val) ==
undefined
){
val =
;
}
if(val){
val =
=
+ val;
}
var r = document
selection
createRange()
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){
document
selection
createRange()
text = rr;
}else{
ntent
value += 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
this
options[this
selectedIndex]
value); this
value =
;
>
<option value=
>FONT</option>
<option value=
Arial
style=
font
family:Arial
>Arial</option>
<option value=
Times
style=
font
family:Times
>Times</option>
<option value=
Courier
style=
font
family:Courier
>Courier</option>
<option value=
Impact
style=
font
family:Impact
>Impact</option>
<option value=
Geneva
style=
font
family:Geneva
>Geneva</option>
<option value=
Optima
style=
font
family:Optima
>Optima</option>
</select>
<select name=
fsize
onChange=
ubbaction(
SIZE
this
options[this
selectedIndex]
value); this
value =
;
>
<option value=
>SIZE</option>
<option value=
>Small</option>
<option value=
>Large</option>
<option value=
>Largest</option>
</select>
<select name=
fcolor
onChange=
ubbaction(
COLOR
this
options[this
selectedIndex]
value); this
value =
;
>
<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