给页面添加脚注功能
FontSize:
-
+ Date: 2006-03-13
摘要:
利用javascript&css实现脚注功能,在公司企业站点,计划说明,注释等相关页面十分适用,简洁,大方,方便实用。
资料来源:网络文/佚名
Having read Daring Fireball's post on footnotes in blogs, I thought it shouldn't be that difficult to come up with a css/javascript solution.
Here's the result.
There are two divs, "content" and "footnotes". "Content" holds the content, "footnotes" is empty. The footnotes are added in-line in span tags (with class="footnote“) within the content.
When the button is clicked, the javascript function looks for spans with class "footnote" in the "content" div. It then swaps the text in the span for a superscripted link, and places the footnote in a div within the "footnote" div.
Normally, the function would be called onLoad.
The function can be called for multiple content and footnote divs.
Advantages:
- You don't have to worry about numbering, for one thing.
- The footnotes can be edited at their insertion point.
- You could give users the choice of how footnotes are formatted, or whether they are shown at all.
Disadvantages:
- Without Javascript, footnotes are left in-line.
Tested on a Mac (Firefox/Safari) and a PC (Firefox/Explorer6).
效果演示地址:http://www.brandspankingnew.net/specials/footnote.html
版权声明:本文属转载作品,版权属原作者所有。
本文链接地址:http://leafor.com/Leafor-blog/Footnotes-with-Javascript&CSS.html
如果你也喜欢本文,记得顶一下,支持我。你的支持是我继续发好文章的最大动力!谢谢!
相关文章
- CSS hack:区分IE6,IE7,firefox (2007-8-8 17:39:48)
- 目前较流行的几种lightbox (2006-6-6 2:43:22)
- 让用户选择链接打开方式:新窗口or当前 (2006-4-21 12:38:45)
- 让用户自由调整页面字体大小 (2006-4-19 23:50:21)
- Smart‘back to top’link (2006-4-17 22:22:4)
- Resources for web developers (2006-4-14 9:33:9)
Comments
- [Quote] [Reply] 1 爱你无名 Said,
- 比较实用的功能,如果不能浏览,可点进入原文件网址,效果可见。Z-blog没有提供代码运行功能,Leafor正在修改中。
- [Quote] [Reply] 3 密陀僧 Said,
- If Instr(para,"[space]")>0 Then source=Replace(source," "," ")
这句代码注释掉了吗?
注意,修改后文章内容中的代码部分重新编辑一下。leafor 于 08-01-19 00:25:03 回复解决了,我是在html编辑模式下写[code][/code]的,所以会出错。我直接在ubb代码下写,就可以了。谢谢啦。
Leave a Comment
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。