查看文章 |
msn.com英文站上的tag切换.
2005-08-30 8:22
是用document.getElementById来获取指定的 id 属性值得到对象.(Returns a reference to the first object with the specified value of the ID attribute.返回 id 属性值等于 sID 的第一个对象的引用。假如对应的为一组对象,则返回该组对象中的第一个。
如果无符合条件的对象,则返回 null 。 ) 然后将此对象的action改变,背景色什么是装饰.
如:
var a=document.getElementById('searchform');//searchform为搜索的form的id.
var b=document.getElementById('b'); //一个tag. 然后c,d,e.
可以加个叫做clicktag的funtion.里面有击活方案,如clicktag(id),用switch,case 'a',case 'b'这样切换到相应的程序段,里面就可以用不同的相对id的属性了.MSN里的是action改变,所以就只要a.action=***就OK了.
然后用onclick来击活,很方便好看.切换的同时不用刷新界面,很实用.
|
最近读者:

