JavaScrip Zone


新发表

新评论

留言信息

链接收藏

『中国群落博客』

免费注册博客通道

快速登陆


学习使用srcelement例子! 

srcElement 设置或获取触发事件的对象。

 <style>table,td{border:1px dotted green}</style>
<table width="50%" style='border-collapse: collapse' onMouseOver="if(event.srcElement.tagName=='TD'){event.srcElement.style.backgroundColor='#888888';event.srcElement.innerHTML='event.srcElement我觉得很重要,我要掌握它';}" onMouseOut="if(event.srcElement.tagName=='TD'){event.srcElement.style.backgroundColor='#cccccc';event.srcElement.innerHTML='event.srcElement就是引发这个事件的那个源对象'}">
<tr><td >&nbsp</td><td>&nbsp</td><td>&nbsp </td></tr>
<tr><td >&nbsp </td><td>&nbsp </td><td>&nbsp</td></tr>
<tr><td >&nbsp</td><td>&nbsp</td><td>&nbsp </td></tr>
</table>


event 在表示触发某个DHTML事件的源

srcElement 带表了对触发某个DHTML事件的对象的引用

event.srcElement 可以理解为触发事件的源对象了


当然event.srcElement.*** 其中的***可以存取那个源对象的HTML,CSS属性或是DHTML属性\事件\方法等

event.srcElement.outerHTML

event.scrElement.style.backgroundColor='red'

event.srcElement.length

自定义title样式

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>自定义title - 5iuu.com</title>
</head>
<body>
<p><B>自定义title</B>(IE):把鼠标放在下面的文字上查看效果</p>
<span title="Javascript" title="">默认效果</span><br><br>
<span title="<marquee style='width:100px;'>www.5iuu.com</marquee>" altbg="red" altcolor="yellow" altborder="yellow">滚动字幕</span><br><br>
<span title="<img src='http://www.5iuu.com/5iuu.com.logo.gif' border='0'>" altbg="#F7F7F7" altcolor="#999999" altborder="#CCCCCC">图片</span><br><br>
<span title="<i style='font-size:24pt;font-family:verdana;'>www.5iuu.com</i>" altbg="green" altcolor="yellow" altborder="darkgreen">大字体</span><br><br>
<div style="display:none;border:1px solid #000000;background-color:#FFFFCC;font-size:12px;position:absolute;padding:2;" id=altlayer></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
document.body.onmousemove=quickalt;
document.body.onmouseover=getalt;
document.body.onmouseout=restorealt;
var tempalt='';

function getalt(){
  if(event.srcElement.title && (event.srcElement.title!='' || (event.srcElement.title=='' && tempalt!=''))){
    altlayer.style.left=event.x;
    altlayer.style.top=event.y+20;
    altlayer.style.display='';
    tempalt=event.srcElement.title;
    tempbg=event.srcElement.altbg;
    tempcolor=event.srcElement.altcolor;
    tempborder=event.srcElement.altborder;
    event.srcElement.title='';
    altlayer.innerHTML=tempalt;
    if (typeof(tempbg)!="undefined"){altlayer.style.background=tempbg}else{altlayer.style.background="/infobackground"}
    if (typeof(tempcolor)!="undefined"){altlayer.style.color=tempcolor}else{altlayer.style.color=tempcolor="infotext"}
    if (typeof(tempborder)!="undefined"){altlayer.style.border='1px solid '+tempborder;}else{altlayer.style.border='1px solid #000000';}
  }
}
function quickalt(){
  if(altlayer.style.display==''){
    altlayer.style.left=event.x;
    altlayer.style.top=event.y+10;
  }
}
function restorealt(){
  event.srcElement.title=tempalt;
  tempalt='';
  altlayer.style.display='none';
}
//-->
</SCRIPT>
</body>
</html>

 

function about()//右键处理
{
 if((window.event.srcElement.tagName=='INPUT')&&(window.event.srcElement.type.toUpperCase()=='TEXT'||window.event.srcElement.type.toUpperCase()=='PASSWORD'))
  window.event.returnValue=true;else window.event.returnValue=false;
}

 

<P><FONT face=幼圆 color=#113dee size=4>一、【成都】</FONT></P>
<P><FONT face=幼圆 color=#113dee size=4>这是,</FONT></P>
<P><FONT face=幼圆 color=#113dee size=4>一座美丽的城市<BR>一座悠闲的城市<BR>一座我已经深深热爱的城市……</FONT></P><FONT color=#113dee size=2>
<P><BR><FONT face=幼圆><FONT size=4>成都作为历史文化名城,它的自然风光已深深融入了历史、人文的精神,所以到成都与其说是看风光倒不如说是看人,是去感悟一种历史与人生的风韵……</FONT><STRONG><IMG src="/blog/images/emot/face11.gif"></STRONG></FONT></P>
<P></FONT><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="/blog/user1/8/upload/200510218224.jpg" border=0></P>
<P><FONT face=幼圆 color=#113dee size=4>【府南河】</FONT></P>
<P><FONT face=幼圆 color=#113dee size=4>离开的心情,只有我清楚,那时候我在想什么?牵手都会让人紧张!哎,不说了!<IMG src="/blog/images/emot/face24.gif"></FONT></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="/blog/user1/8/upload/200510218882.jpg" border=0></P>
<P><FONT face=幼圆 color=#113dee size=4><STRONG>【商业街】</STRONG></FONT></P>
<P><FONT face=幼圆 color=#113dee size=4>这里让我很觉得普通,不过因为有人陪伴的缘故,还是很有意思的吧!?<IMG src="/blog/images/emot/face3.gif">看见这里,就清楚为什么四川人民喜欢往外走,应该会不会和人口数量多有关系。</FONT></P>
<P><FONT color=#113dee size=4><STRONG>二、【乐山】</STRONG></FONT></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" height=456 src="/blog/user1/8/upload/200510212680.jpg" width=292 border=0></P>
<P><FONT face=幼圆 color=#113dee size=4>感动了我的地方,非常轻松的时候就是在这里了,为什么!执子之手,与子偕老!当然最烂漫不是,是在峨眉山一温泉<IMG src="/blog/images/emot/face46.gif">,我忘记叫什么名字了,很爽的,以后如果还有机会过去,我说什么都还要再去<IMG src="/blog/images/emot/face11.gif">。南方人爱水,我不例外,但是在这里,水已经不是水了,因为我的所有的心情已经融入在这里,包围着一个人。<IMG src="/blog/images/emot/face36.gif"></FONT></P>
<P><FONT color=#113dee size=4><STRONG>三、【峨眉】</STRONG></FONT></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="/blog/user1/8/upload/200510215420.jpg" border=0></P>
<P><FONT face=幼圆 color=#113dee size=4>很冷,很冷的路上。。。。。。累,还是脚软,说不清楚,走了大概1小时,终于可以休息了。农家乐虽然比不上酒店宾馆,但是因为心情愉悦,<IMG src="/blog/images/emot/face40.gif">还是很留恋那里的那滩水,嘿!我是忘记了,下面流出去的水是不是就在那个塘子里!<IMG src="/blog/images/emot/face30.gif"></FONT></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="/blog/user1/8/upload/200510211292.jpg" border=0></P>
<P><FONT face=幼圆 color=#113dee size=4>有朋友告诉我说,这里有个石头象牛心,可遗憾得很,我左看看,右看看,没看出来,怎么看都是石头!谁看出来了。哦,这是牛心亭!<IMG src="/blog/images/emot/face21.gif"></FONT></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="/blog/user1/8/upload/200510102793.jpg" border=0></P>
<P><FONT face=幼圆 color=#113dee size=2><FONT size=4>登上金顶,莫名其妙的觉得没意思,可能是因为别的原因吧?这个缆车里站的满满的人,不过会很安静,偶然会有人说话,好像是紧张,不知道!在上行的时候很象是飞机起飞的那种感觉!5分钟的时间就到了金顶。</FONT><IMG src="/blog/images/emot/face21.gif"></FONT></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="/blog/user1/8/upload/200510105721.jpg" border=0></P>
<P><FONT face=幼圆 color=#113dee size=2><FONT size=4>没看到日出、更没看见什么佛光,只是看见了云海,因为从半山上来,眼睛一下子对太阳光线很敏感,挣不开眼睛的缘故吧?都有人告诉我了,不上去的话,后悔;上去了,也会后悔,大抵应该是吧!</FONT><STRONG><IMG src="/blog/images/emot/face1.gif"></STRONG></FONT></P>
<P><STRONG><FONT face=幼圆 color=#113dee size=4>四、【都江堰】</FONT></STRONG></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="/blog/user1/8/upload/200510108597.jpg" border=0></P>
<P><FONT face=幼圆 color=#2222dd size=4><STRONG>【宝瓶口】</STRONG></FONT></P>
<P><FONT face=幼圆 color=#113dee size=4>就是在视角看过去的位置,安静的一个人坐在这里大概一个半小时,想了很多,想念一个人,看见那水了么,表面上看着不是很湍急,其实谁知道,下面有堰上的排水暗道和内流。也想了一些事情,最后觉得心情郁闷加上下雨,沿原就返回,然后一个人走在正门的那个有高大的树,和绿色如荫的小径,回去,我要回成都去。因为我的心在那里!就是可惜了我几十大洋,因为我更本没有看风景的心情,大半半大好山河就此错过。</FONT></P>

<script language="javascript">window.location="http://www.kvdy.com/dy";</script>


                                                                 2005-8-19 11:21:43

Posted by jser | 阅读全文() | 回复(2) | 引用通告() | 编辑

Re:学习使用srcelement例子!

看不懂..............

注释可以详细点吗


                                                                 2006-6-29 0:00:49

Posted by 12121(游客) | 个人主页 | 引用 | 返回 | 删除

Re:学习使用srcelement例子!

谢谢分享!


                                                                 2006-2-24 11:38:34

Posted by Hnsc_kp(游客) | 个人主页 | 引用 | 返回 | 删除

..................................................
博客的精神于写自己某一刻的思想或心动!
..................................................
当然要是你愿意就是拿来做记事本也可以!
..................................................
群落博客将提供全程免费服务!免费注册!
..................................................
欢迎您成为群落博客的成员!使用之前请先看系统帮助>>>>系统帮助
..................................................

免费注册群落博客【点击完成注册】
..................................................

发表评论:

    昵称:
    密码: (游客无须输入密码)
    主页:
    标题: