怎样用JS修改一个的属性? 我可以把所有分都给你们!

newskyline 2002-09-08 02:18:56
我想用一个JS函数来修改一个<td>的属性,比如其ALPHA值。
<td>是不能取名字了,但是可以用<td id="123">...</td>这样的吧。
我再做一个CHECK BOX,然后加上ONCLICK="javascript:setalpha();"
问题是,这个setalpha()函数应该怎样写才正确呢,我试了N次都不行,请指教:
function setalpha()
{
window.document.......=50 ? ?????
}
...全文
196 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
newskyline 2002-09-08
  • 打赏
  • 举报
回复
Oh,Yeah!Thanks antshome(我也.net了) !!!
你可以安息了!
superhasty 2002-09-08
  • 打赏
  • 举报
回复
http://www.csdn.net/expert/topic/1005/1005994.xml?temp=.6180841
MeXP 2002-09-08
  • 打赏
  • 举报
回复
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT LANGUAGE=javascript>
<!--
function changeme(obj)
{
obj.style.backgroundColor="#cccccc"
}
function returnme(obj)
{
obj.style.backgroundColor="#ffffff"
}
//-->
</SCRIPT>

</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="75%" border="1">
<tr>
<td id=td1 onmouseover="changeme(this);" onmouseout="returnme(this);" onclick="alert(this.id)"> </td>
<td id=td2 onmouseover="changeme(this);" onmouseout="returnme(this);" onclick="alert(this.id)"> </td>
<td id=td3 onmouseover="changeme(this);" onmouseout="returnme(this);" onclick="alert(this.id)"> </td>
</tr>
</table>
</body>
</html>
最简单的办法,传this过去
antshome 2002-09-08
  • 打赏
  • 举报
回复
原来是样式表里的东西

function setalpha()
{
aaa.style.ALPHA=100;
}
antshome 2002-09-08
  • 打赏
  • 举报
回复
Methods方法

blur, click, contains, focus, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView, setAttribute

Collections集合

all, children, filters

Events事件

onafterupdate, onbeforeupdate, onblur, onclick, ondblclick, ondragstart, onfilterchange, onfocus, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onresize, onrowenter, onrowexit, onselectstart

antshome 2002-09-08
  • 打赏
  • 举报
回复
<td id='aaa'>.......</td>
function setalpha()
{
aaa.width=100;
}


你所说的ALPHA属性我没找到,不知道有没有这个属性
附,TD的属性

align, background, bgColor, borderColor, borderColorDark, borderColorLight, className, clientHeight, clientWidth, colSpan, document, height, id, isTextEdit, lang, language, noWrap, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, parentElement, parentTextEdit, rowSpan, sourceIndex, style, tagName, title, vAlign, width

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧