今天学习jQuery 属性和CSS, 学了css后面做示例才看得明白 属性 1.attr(key,value) 为所有匹配的元素设置一个属性值。 相当于给key赋值如 $("img").attr("src","http://www.usle.cn/logo.gif"); 即意为给img元素赋予图片地址。类似这个在上一篇 移除或替换链接指向 中用到了此方法。 2.attr(key,fn) 类似上面,只不过fn当做函数来写,如$("img").attr("title",function(){return this.src});这个函数是将图片的链接赋给图片的title属性中。 3.attr(name) 很容易弄明白,取得第一个匹配元素的属性值,如果元素没有相应属性,则返回undefined 4.attr(properties) 光看这个看不明白,实际上是给匹配的元素批量设置很多属性 。举例$("img").attr({title:"this is title",alt:"this is alt"}); 需要注意的是属性名后面跟“:”冒号,多个属性间用逗号隔开,外围包上大括号“{}”。 5.removeAttr(name) 从每一个匹配的元素中删除一个属性 ,如$("img").removeAttr("src");意为移除图片的链接地址。 类 1.addClass(class) 为每个匹配的元素添加指定的类名(css样式)。如$("p").addClass("p1"); 2.removeClass(class) 很容易理解,移除css样式 3.toggleClass(class) 如果存在这样css样式就删除一个样式,或者不存在的话就添加一个样式。 $("p").toggleClass("p1");意为为没有类名p1的css样式的p元素添加p1样式,对有p1样式的pf元素,删除它的p1 css样式。 HTML 1.html() 取得第一个匹配元素的html内容,用法如 $("div").html(); 2.html(val) 设置每一个匹配元素的html内容, $("div").html(“hello,world”); 给匹配的div元素设置内容为hello,world 。原有的会被清除。 文本 1.text() 取得所有匹配元素的内容。就好比提取出纯文本一样。用法同上述html。 2.text(val) 类似html(val) ,但将编码 HTML (这句没看明白,反正和html差不多) 值 1.val() 获得第一个匹配元素的当前值。用法也如 $("input").val(); 2.val(val) 为匹配的元素赋值 check,select,radio等都能使用为之赋值 用法如 $("input").val("hello") ,类似$("input").attr("value","hi"); 3.赋多个值用法如 $("input").val(["check2", "radio1"]); 意为给 check2 radio1 这两项同时赋上值,即同时选择上复选框值为check2的和单选值为radio1的。 转自:http://www.usle.cn/blog/article.asp?id=829
jQuery由美国人John Resig创建,至今已吸引了来自世界各地的众多javascript高手加入其team. jQuery是继prototype之后又一个优秀的Javascrīpt框架。其经典的Slogan是“Write Less, Do more”(写更少的代码,做更多的事情)。jQuery是轻量级的js库(压缩后只有21k) ,这是其它的js库所不及的,它兼容CSS3,还兼容各种浏览器 (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)。
jQuery是一个快速的,简洁的javaScript库,使用户能更方便地处理HTML documents、events、实现动画效果,并且方便地为网站提供AJAX交互。jQuery还有一个比较大的优势是,它的文档说明很全,而且各种 应用也说得很详细,同时还有许多成熟的插件可供选择。jQuery能够使用户的html页保持代码和html内容分离,也就是说,不用再在html里面插 入一堆js来调用命令了,只需定义id即可。
全世界的JS高手都在为jQuery开发着各种jQuery插件, 在帕兰映像之前的文章里面, 也介绍过很多关于JQeury插件的文章:
另位在本站有关设计开发的几篇热门搜索文章里面, 也总能看到jQuery的踪影.
- 30多个CSS和JS下拉菜单资源
- 30个精挑细致的Ajax和Javascript 技巧
- 37个Ajax和CSS实现的Tab选项卡
- 13个效果超酷的Javascript网页导航菜单
- 30个Ajax/Javscript 滑动门, 滚动栏和滚动条技术
这两天又看到一篇收集jQuery插件的文章, 出自kollermedia, 收集了200多个jQuery插件. 虽然是比较早期的文章, 但对设计开发人员来说还是非常有用的.
文件上传类jQuery插件
Ajax File Upload. jQUploader. Multiple File Upload plugin. jQuery File Style. Styling an input type file. Progress Bar Plugin.
表单验证类jQuery插件
jQuery Validation. Auto Help. Simple jQuery form validation. jQuery XAV - form validations. jQuery AlphaNumeric. Masked Input. TypeWatch Plugin. Text limiter for form fields. Ajax Username Check with jQuery.
表单选择框类jQuery插件
jQuery Combobox. jQuery controlled dependent (or Cascadign) Select List. Multiple Selects. Select box manipulation. Select Combo Plugin. jQuery - LinkedSelect Auto-populate multiple select boxes. Choose Plugin (Select Replacement).
表单基本、输入框、选择框等jQuery插件
jQuery Form Plugin. jQuery-Form. jLook Nice Forms. jNice. Ping Plugin. Toggle Form Text. ToggleVal. jQuery Field Plugin. jQuery Form’n Field plugin. jQuery Checkbox manipulation. jTagging. jQuery labelcheck. Overlabel. 3 state radio buttons. ShiftCheckbox jQuery Plugin. Watermark Input. jQuery Checkbox (checkboxes with imags). jQuery SpinButton Control. jQuery Ajax Form Builder. jQuery Focus Fields. jQuery Time Entry.
时间、日期和颜色选取类jQuery插件
jQuery UI Datepicker. jQuery date picker plugin. jQuery Time Picker. Time Picker. ClickPick. TimePicker. Farbtastic jQuery Color Picker Plugin. Color Picker by intelliance.fr.
投票类jQuery插件
jQuery Star Rating Plugin. jQuery Star Rater. Content rater with asp.net, ajax and jQuery. Half-Star Rating Plugin.
搜索类jQuery插件
jQuery Suggest. jQuery Autocomplete. jQuery Autocomplete Mod. jQuery Autocomplete by AjaxDaddy. jQuery Autocomplete Plugin with HTML formatting. jQuery Autocompleter. AutoCompleter (Tutorial with PHP&MySQL). quick Search jQuery Plugin.
jQuery编辑器插件
jTagEditor. WYMeditor. jQuery jFrame. Jeditable - edit in place plugin for jQuery. jQuery editable. jQuery Disable Text Select Plugin. Edit in Place with Ajax using jQuery. jQuery Plugin - Another In-Place Editor. TableEditor. tEditable - in place table editing for jQuery.
多媒体、视频、Flash等类jQuery插件
jMedia - accessible multi-media embedding. JBEdit - Ajax online Video Editor. jQuery MP3 Plugin. jQuery Media Plugin. jQuery Flash Plugin. Embed QuickTime. SVG Integration.
图片类jQuery插件
ThickBox. jQuery lightBox plugin. jQuery Image Strip. jQuery slideViewer. jQuery jqGalScroll 2.0. jQuery - jqGalViewII. jQuery - jqGalViewIII. jQuery Photo Slider. jQuery Thumbs - easily create thumbnails. jQuery jQIR Image Replacement. jCarousel Lite. jQPanView. jCarousel. Interface Imagebox. Image Gallery using jQuery, Interface & Reflactions. simple jQuery Gallery. jQuery Gallery Module. EO Gallery. jQuery ScrollShow. jQuery Cycle Plugin. jQuery Flickr. jQuery Lazy Load Images Plugin. Zoomi - Zoomable Thumbnails. jQuery Crop - crop any image on the fly. Image Reflection.
Google地图类jQuery插件应用
jQuery Plugin googlemaps. jMaps jQuery Maps Framework. jQmaps. jQuery & Google Maps. jQuery Maps Interface forr Google and Yahoo maps. jQuery J Maps - by Tane Piper.
游戏类jQuery插件
Tetris with jQuery. jQuery Chess. Mad Libs Word Game. jQuery Puzzle. jQuery Solar System (not a game but awesome jQuery Stuff).
表格,网格类jQuery插件
UI/Tablesorter. jQuery ingrid. jQuery Grid Plugin. Table Filter - awesome!. TableEditor. jQuery Tree Tables. Expandable “Detail” Table Rows. Sortable Table ColdFusion Costum Tag with jQuery UI. jQuery Bubble. TableSorter. Scrollable HTML Table. jQuery column Manager Plugin. jQuery tableHover Plugin. jQuery columnHover Plugin. jQuery Grid. TableSorter plugin for jQuery. tEditable - in place table editing for jQuery. jQuery charToTable Plugin. jQuery Grid Column Sizing. jQuery Grid Row Sizing.
统计类jQuery插件
jQuery Wizard Plugin . jQuery Chart Plugin. Bar Chart.
边框、圆角、背景类jQuery插件
jQuery Corner. jQuery Curvy Corner. Nifty jQuery Corner. Transparent Corners. jQuery Corner Gallery. Gradient Plugin.
文字和超链接类jQuery插件
jQuery Spoiler plugin. Text Highlighting. Disable Text Select Plugin. jQuery Newsticker. Auto line-height Plugin. Textgrad - a text gradient plugin. LinkLook - a link thumbnail preview. pager jQuery Plugin. shortKeys jQuery Plugin. jQuery Biggerlink. jQuery Ajax Link Checker.
文本提示类jQuery插件
jQuery Plugin - Tooltip. jTip - The jQuery Tool Tip. clueTip. BetterTip. Flash Tooltips using jQuery. ToolTip.
菜单和导航类jQuery插件
jQuery Tabs Plugin - awesome! . [demo nested tabs.] another jQuery nested Tab Set example (based on jQuery Tabs Plugin). jQuery idTabs. jdMenu - Hierarchical Menu Plugin for jQuery. jQuery SuckerFish Style. jQuery Plugin Treeview. treeView Basic. FastFind Menu. Sliding Menu. Lava Lamp jQuery Menu. jQuery iconDock. jVariations Control Panel. ContextMenu plugin. clickMenu. CSS Dock Menu. jQuery Pop-up Menu Tutorial. Sliding Menu.
http://stilbuero.de/jquery/tabs_3/
幻灯片、手风琴特效类jQuery插件
jQuery Plugin Accordion. jQuery Accordion Plugin Horizontal Way. haccordion - a simple horizontal accordion plugin for jQuery. Horizontal Accordion by portalzine.de. HoverAccordion. Accordion Example from fmarcia.info. jQuery Accordion Example. jQuery Demo - Expandable Sidebar Menu. Sliding Panels for jQuery. jQuery ToggleElements. Coda Slider. jCarousel. Accesible News Slider Plugin. Showing and Hiding code Examples. jQuery Easing Plugin. jQuery Portlets. AutoScroll. Innerfade.
拖放类jQuery插件
UI/Draggables. EasyDrag jQuery Plugin. jQuery Portlets. jqDnR - drag, drop resize. Drag Demos.
XML XSL JSON Feeds相关jQuery插件
XSLT Plugin. jQuery Ajax call and result XML parsing. xmlObjectifier - Converts XML DOM to JSON. jQuery XSL Transform. jQuery Taconite - multiple Dom updates. RSS/ATOM Feed Parser Plugin. jQuery Google Feed Plugin.
浏览器
Wresize - IE Resize event Fix Plugin. jQuery ifixpng. jQuery pngFix. Link Scrubber - removes the dotted line onfocus from links. jQuery Perciformes - the entire suckerfish familly under one roof. Background Iframe. QinIE - for proper display of Q tags in IE. jQuery Accessibility Plugin. jQuery MouseWheel Plugin.
警告, 提示, 确认等对话框
jQuery Impromptu. jQuery Confirm Plugin. jqModal. SimpleModal.
CSS
jQuery Style Switcher. JSS - Javascript StyleSheets. jQuery Rule - creation/manipulation of CSS Rules. jPrintArea.
DOM、AJAX和其它JQuery插件
FlyDOM. jQuery Dimenion Plugin. jQuery Loggin. Metadata - extract metadata from classes, attributes, elements. Super-tiny Client-Side Include Javascript jQuery Plugin. Undo Made Easy with Ajax. JHeartbeat - periodically poll the server. Lazy Load Plugin. Live Query. jQuery Timers. jQuery Share it - display social bookmarking icons. jQuery serverCookieJar. jQuery autoSave. jQuery Puffer. jQuery iFrame Plugin. Cookie Plugin for jQuery. jQuery Spy - awesome plugin. Effect Delay Trick. jQuick - a quick tag creator for jQuery. Metaobjects. elementReady.
转自:http://cn.73it.cn/?p=22
今天偶然看到一篇文章JavaFX Brush for Syntax Highlighter ,里面提到了在网页上对JavaFX的代码进行语法高亮,只需要一个JS文件就够了,看效果还挺不错的。其实以前也看到过很多网站都有Java的语法高亮,Google了一下,果然发现一个开源的语法高亮的东东,http://code.google.com/p/syntaxhighlighter/。看效果跟上面提到的那个JavaFx的还挺像,闲着也是闲着,就照着他的Guide把博客里面的一些代码加了语法高亮,具体步骤. 不过很讨厌的是语法高亮后的每一行都加上了li标签,这个是JavaScript动态加的,我改了模板,对语法高亮的li格式再定义了一下,还是显示li的图标。。。