xhtml里面有个Button,value是“加粗斜体按钮” ,其中 “加粗”是加粗过的 , “斜体”显示为斜体的, “按钮”为正常格式,哪个高手帮忙下 谢谢了
解决方案 »
- Deployer:149026
- 关于jsp静态化的问题,高手入!
- com.sun.data.provider
- Internet起始点 您最理想的浏览器主页!速度+实用
- 谁有JSP 的在线编辑器求共享
- 我的页面放在那里一段时间后再去操作,出现Communication link failure: java.net.SocketException
- 请教大家用IDE开发的时候目录结构的问题
- 怎样上传文件到数据库中
- 我的分页程序出现java.lang.NullPointerException该怎么办?
- 请问在jsp中是不是不允许有自定义的函数呀?
- 多附件上传并且不显示浏览按钮,怎么做?
- JSP 留言回复
<b>加粗</b><i>斜体</i>按钮
</button>
<html>
<head>
<title>Format Brush</title>
</head>
<style>
table{
border: solid #ccc 1px;
}
td{
border: solid #ccc 1px;
width: 140px;
height: 25px;
}
.selected{
border: solid red 1px;
}
a{
text-decoration: none;
color: black;
font-weight: bold;
}
.b{
}
.i{
font-style: italic;
}
</style>
<body>
<div>
<a href="javascript:setBold();" class='b'>加粗</a>
<a href="javascript:setItalic();" class="i">斜体</a>
</div>
<table id='t' cellpadding='0' cellspacing='0' border='1'>
<tr><td class="selected">column1</td></tr>
</table>
</body>
<script> //辅助函数
function $(id){return document.getElementById(id);}
var tb = $('t');
var selectedCell = tb.rows[0].cells[0];//当前被选择的单元格。
var brushing = false;//是否正在使用刷子
function setBold(){
selectedCell.style.fontWeight = "bold";
}
function setItalic(){
selectedCell.style.fontStyle = "italic";
}
//格式拷贝
function copyFormat(source, dist){
dist.style.fontWeight = source.style.fontWeight;
dist.style.fontStyle = source.style.fontStyle;
dist.style.textDecoration = source.style.textDecoration;
dist.style.color = source.style.color;
}
function doBrush(e){
if(!brushing){
$('tip').style.display = '';
}
else{
$('tip').style.display = 'none';
}
brushing = !brushing;
}
document.body.onload = function(){
for(var i=0; i<tb.rows.length; i++){
for(var j=0; j<tb.rows[i].cells.length; j++){
tb.rows[i].cells[j].onclick = function(){
if(brushing){
copyFormat(selectedCell, this);
}
};
}
}
}
</script>
</html>
<Button><B><I>value</I></B></Button>