js插件类库组织与管理(基于asp.net管理)

testjs插件类库组织与管理
先举个例子,比如jquery插件中的calendar在一个页面中就得有如下代码


代码如下:

<style type="text/css">
@import ""script/calendar/jquery.datepick.css";
</style>
<script type="text/javascript" src="script/jquery1.3.2.js"></script>
<script type="text/javascript" src=""script/calendar/jquery.datepick.js"></script>
<script type="text/javascript" src=""script/calendar/jquery.datepick-zh-CN.js"></script>

看上面代码,calendar代码得运用四个相关的文件。其中jquery1.3.2.js是必须的,jquery.datepick-zh-CN.js依赖于jquery.datepick.js(日历插件),而jquery.datepick.css是插件的样式。
运用以上代码得很小心的对待插件的依赖关系,主次关系不能换,移动文件路径还得改动文件src路径,以上script中下载js文件都是单线程下载,理想的是进行多线程下载(firebug看得出来),再者就是插件的缓存问题(插件更新了,客户端可能还保存着原来的文件)。
看过不少网上关于这方面的解决方案,博客园中有SmartScript和javaeye中有JSI,它们貌似都存在一个boot.js文件。而我的解决方案就只需要一个script后面跟插件参数即可。
以下是我对上述问题的一个解决方案:
<script type="text/javascript" src="script.do?plugins=calendar"></script>
在一个页面中只需要js应用的插件只需要script.do后跟参数后插件名参数即可,其它的工作就是在整体写一个插件资源配置文件(写插件配置的人得弄清楚js相关资源,这个只需要配置一次),至于其它什么也不需要弄。
插件资源配置文件


代码如下:

<?xml version="1.0" encoding="utf-8" ?>
<script path="script/plugins/" name="script/jquery1.3.2.js" lazy="script/plugins/lazy/jquery.lazy-1.3.1.js">
<!--自动完成-->
<plugin name="autocomplete" file="autocomplete/jquery.autocomplete.js">
<lazy file="autocomplete/jquery.autocomplete.css"></lazy>
</plugin>
<!--日历-->
<plugin name="calendar" file="calendar/jquery.datepick.pack.js">
<lazy file="calendar/jquery.datepick.css"></lazy>
<lazy file="calendar/jquery.datepick-zh-CN.js"></lazy>
</plugin>
<!--提示框-->
<plugin name="tip" file="tip/jquery.tip.js">
<lazy file="tip/bs.css"></lazy>
</plugin>
<!--拖动-->
<plugin name="draggable" file="jquery.draggable.js">
<lazy file="ui/ui.core.js"></lazy>
<lazy file="draggable/ui.draggable.css"></lazy>
</plugin>
<!--拖动放下-->
<plugin name="droppable" file="jquery.droppable.js">
<lazy file="ui/ui.core.js"></lazy>
<lazy file="droppable/ui.droppable.css"></lazy>
<lazy file="draggable/ui.draggable.js"></lazy>
<lazy file="draggable/ui.draggable.css"></lazy>
</plugin>
</script>

html示例代码:


代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>无标题页</title>
<%-- <script type="text/javascript" src="script/jquery1.3.2.js"></script>
<script type="text/javascript" src="script/plugins/lazy/jquery.lazy-1.3.1.js"></script>--%>
<script type="text/javascript" src="script.do?plugins=autocomplete,tip"></script>
</head>
<body>
<input type="text" id="suggest1" style="border:1px solid #ccc"/><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<a href="#" title="Basic Tool Tip" class="bslink">Tip1</a><br />
</body>
</html>
<script>
var cities = [
"Aberdeen", "Ada", "Adamsville", "Addyston", "Adelphi", "Adena", "Adrian", "Akron",
"Albany", "Alexandria", "Alger", "Alledonia", "Alliance", "Alpha", "Alvada",
"Alvordton", "Amanda", "Amelia", "Amesville", "Amherst", "Amlin", "Amsden",
"Amsterdam", "Andover", "Anna", "Ansonia", "Antwerp", "Apple Creek", "Arcadia",
"Arcanum", "Archbold", "Arlington", "Ashland", "Ashley", "Ashtabula", "Ashville",
"Athens", "Attica", "Atwater", "Augusta", "Aurora", "Austinburg", "Ava", "Avon",
"Avon Lake", "Bainbridge", "Bakersville", "Baltic", "Baltimore", "Bannock",
"Barberton", "Barlow", "Barnesville", "Bartlett", "Barton", "Bascom", "Batavia",
"Bath", "Bay Village", "Beach City", "Beachwood", "Beallsville", "Beaver",
"Beaverdam", "Bedford", "Bellaire", "Bellbrook", "Belle Center", "Belle Valley",
"Bellefontaine", "Bellevue", "Bellville", "Belmont", "Belmore", "Beloit", "Belpre",
"Benton Ridge", "Bentonville", "Berea", "Bergholz", "Berkey", "Berlin",
"Berlin Center", "Berlin Heights", "Bethel", "Bethesda", "Bettsville", "Beverly",
"Bidwell", "Big Prairie", "Birmingham", "Blacklick", "Bladensburg", "Blaine",
"Blakeslee", "Blanchester", "Blissfield", "Bloomdale", "Bloomingburg",
"Bloomingdale", "Bloomville", "Blue Creek", "Blue Rock", "Bluffton",
"Bolivar", "Botkins", "Bourneville", "Bowerston", "Bowersville",
"Bowling Green", "Bradford", "Bradner", "Brady Lake", "Brecksville",
"Bremen", "Brewster", "Brice", "Bridgeport", "Brilliant", "Brinkhaven",
"Bristolville", "Broadview Heights", "Broadway", "Brookfield", "Brookpark",
"Brookville", "Brownsville", "Brunswick", "Bryan", "Buchtel", "Buckeye Lake",
"Buckland", "Bucyrus", "Buffalo", "Buford", "Burbank", "Burghill", "Burgoon",
"Burkettsville", "Burton", "Butler", "Byesville", "Cable", "Cadiz", "Cairo",
"Caldwell", "Caledonia", "Cambridge", "Camden", "Cameron", "Camp Dennison",
"Campbell", "Canal Fulton", "Canal Winchester", "Canfield", "Canton", "Carbon Hill",
"Carbondale", "Cardington", "Carey", "Carroll", "Carrollton", "Casstown",
"Castalia", "Catawba", "Cecil", "Cedarville", "Celina", "Centerburg",
"Chagrin Falls", "Chandlersville", "Chardon", "Charm", "Chatfield", "Chauncey",
"Cherry Fork", "Chesapeake", "Cheshire", "Chester", "Chesterhill", "Chesterland",
"Chesterville", "Chickasaw", "Chillicothe", "Chilo", "Chippewa Lake",
"Christiansburg", "Cincinnati", "Circleville", "Clarington", "Clarksburg",
"Clarksville", "Clay Center", "Clayton", "Cleveland", "Cleves", "Clifton",
"Clinton", "Cloverdale", "Clyde", "Coal Run", "Coalton", "Coldwater", "Colerain",
"College Corner", "Collins", "Collinsville", "Colton", "Columbia Station",
"Columbiana", "Columbus", "Columbus Grove", "Commercial Point", "Conesville",
"Conneaut", "Conover", "Continental", "Convoy", "Coolville", "Corning", "Cortland",
"Coshocton", "Covington", "Creola", "Crestline", "Creston", "Crooksville",
"Croton", "Crown City", "Cuba", "Cumberland", "Curtice", "Custar", "Cutler",
"Cuyahoga Falls", "Cygnet", "Cynthiana", "Dalton", "Damascus", "Danville",
"Dayton", "De Graff", "Decatur", "Deerfield", "Deersville", "Defiance",
"Delaware", "Dellroy", "Delphos", "Delta", "Dennison", "Derby", "Derwent",
"Deshler", "Dexter City", "Diamond", "Dillonvale", "Dola", "Donnelsville",
"Dorset", "Dover", "Doylestown", "Dresden", "Dublin", "Dunbridge", "Duncan Falls",
"Dundee", "Dunkirk", "Dupont", "East Claridon", "East Fultonham",
"East Liberty", "East Liverpool", "East Palestine", "East Rochester",
"East Sparta", "East Springfield", "Eastlake", "Eaton", "Edgerton", "Edison",
"Edon", "Eldorado", "Elgin", "Elkton", "Ellsworth", "Elmore", "Elyria",
"Empire", "Englewood", "Enon", "Etna", "Euclid", "Evansport", "Fairborn",
"Fairfield", "Fairpoint", "Fairview", "Farmdale", "Farmer", "Farmersville",
"Fayette", "Fayetteville", "Feesburg", "Felicity", "Findlay", "Flat Rock",
"Fleming", "Fletcher", "Flushing", "Forest", "Fort Jennings", "Fort Loramie",
"Fort Recovery", "Fostoria", "Fowler", "Frankfort", "Franklin",
"Franklin Furnace", "Frazeysburg", "Fredericksburg", "Fredericktown",
"Freeport", "Fremont", "Fresno", "Friendship", "Fulton", "Fultonham",
"Galena", "Galion", "Gallipolis", "Galloway", "Gambier", "Garrettsville",
"Gates Mills", "Geneva", "Genoa", "Georgetown", "Germantown", "Gettysburg",
"Gibsonburg", "Girard", "Glandorf", "Glencoe", "Glenford", "Glenmont",
"Glouster", "Gnadenhutten", "Gomer", "Goshen", "Grafton", "Grand Rapids",
"Grand River", "Granville", "Gratiot", "Gratis", "Graysville", "Graytown",
"Green", "Green Camp", "Green Springs", "Greenfield", "Greenford",
"Greentown", "Greenville", "Greenwich", "Grelton", "Grove City",
"Groveport", "Grover Hill", "Guysville", "Gypsum", "Hallsville",
"Hamden", "Hamersville", "Hamilton", "Hamler", "Hammondsville",
"Hannibal", "Hanoverton", "Harbor View", "Harlem Springs", "Harpster",
"Harrisburg", "Harrison", "Harrisville", "Harrod", "Hartford", "Hartville",
"Harveysburg", "Haskins", "Haverhill", "Haviland", "Haydenville", "Hayesville",
"Heath", "Hebron", "Helena", "Hicksville", "Higginsport", "Highland", "Hilliard",
"Hillsboro", "Hinckley", "Hiram", "Hockingport", "Holgate", "Holland",
"Hollansburg", "Holloway", "Holmesville", "Homer", "Homerville", "Homeworth",
"Hooven", "Hopedale", "Hopewell", "Houston", "Howard", "Hoytville", "Hubbard",
"Hudson", "Huntsburg", "Huntsville", "Huron", "Iberia", "Independence",
"Irondale", "Ironton", "Irwin", "Isle Saint George", "Jackson", "Jackson Center",
"Jacksontown", "Jacksonville", "Jacobsburg", "Jamestown", "Jasper",
"Jefferson", "Jeffersonville", "Jenera", "Jeromesville", "Jerry City",
"Jerusalem", "Jewell", "Jewett", "Johnstown", "Junction City", "Kalida",
"Kansas", "Keene", "Kelleys Island", "Kensington", "Kent", "Kenton",
"Kerr", "Kettlersville", "Kidron", "Kilbourne", "Killbuck", "Kimbolton",
"Kings Mills", "Kingston", "Kingsville", "Kinsman", "Kipling", "Kipton",
"Kirby", "Kirkersville", "Kitts Hill", "Kunkle", "La Rue", "Lacarne",
"Lafayette", "Lafferty", "Lagrange", "Laings", "Lake Milton", "Lakemore",
"Lakeside Marblehead", "Lakeview", "Lakeville", "Lakewood", "Lancaster",
"Langsville", "Lansing", "Latham", "Latty", "Laura", "Laurelville",
"Leavittsburg", "Lebanon", "Lees Creek", "Leesburg", "Leesville",
"Leetonia", "Leipsic", "Lemoyne", "Lewis Center", "Lewisburg",
"Lewistown", "Lewisville", "Liberty Center", "Lima", "Limaville",
"Lindsey", "Lisbon", "Litchfield", "Lithopolis", "Little Hocking",
"Lockbourne", "Lodi", "Logan", "London", "Londonderry",
"Long Bottom", "Lorain", "Lore City", "Loudonville", "Louisville",
"Loveland", "Lowell", "Lowellville", "Lower Salem", "Lucas",
"Lucasville", "Luckey", "Ludlow Falls", "Lynchburg", "Lynx",
"Lyons", "Macedonia", "Macksburg", "Madison", "Magnetic Springs",
"Magnolia", "Maineville", "Malaga", "Malinta", "Malta", "Malvern",
"Manchester", "Mansfield", "Mantua", "Maple Heights", "Maplewood",
"Marathon", "Marengo", "Maria Stein", "Marietta", "Marion",
"Mark Center", "Marshallville", "Martel", "Martin", "Martins Ferry",
"Martinsburg", "Martinsville", "Marysville", "Mason", "Massillon",
"Masury", "Maumee", "Maximo", "Maynard", "Mc Arthur", "Mc Clure",
"Mc Comb", "Mc Connelsville", "Mc Cutchenville", "Mc Dermott",
"Mc Donald", "Mc Guffey", "Mechanicsburg", "Mechanicstown",
"Medina", "Medway", "Melmore", "Melrose", "Mendon", "Mentor",
"Mesopotamia", "Metamora", "Miamisburg", "Miamitown", "Miamiville",
"Middle Bass", "Middle Point", "Middlebranch", "Middleburg",
"Middlefield", "Middleport", "Middletown", "Midland", "Midvale",
"Milan", "Milford", "Milford Center", "Millbury", "Milledgeville",
"Miller City", "Millersburg", "Millersport", "Millfield",
"Milton Center", "Mineral City", "Mineral Ridge", "Minerva",
"Minford", "Mingo", "Mingo Junction", "Minster", "Mogadore",
"Monclova", "Monroe", "Monroeville", "Montezuma", "Montpelier",
"Montville", "Morral", "Morristown", "Morrow", "Moscow",
"Mount Blanchard", "Mount Cory", "Mount Eaton", "Mount Gilead",
"Mount Hope", "Mount Liberty", "Mount Orab", "Mount Perry",
"Mount Pleasant", "Mount Saint Joseph", "Mount Sterling",
"Mount Vernon", "Mount Victory", "Mowrystown", "Moxahala",
"Munroe Falls", "Murray City", "Nankin", "Napoleon", "Nashport",
"Nashville", "Navarre", "Neapolis", "Neffs", "Negley",
"Nelsonville", "Nevada", "Neville", "New Albany", "New Athens",
"New Bavaria", "New Bloomington", "New Bremen", "New Carlisle",
"New Concord", "New Hampshire", "New Haven", "New Holland",
"New Knoxville", "New Lebanon", "New Lexington", "New London",
"New Madison", "New Marshfield", "New Matamoras", "New Middletown",
"New Paris", "New Philadelphia", "New Plymouth", "New Richmond",
"New Riegel", "New Rumley", "New Springfield", "New Straitsville",
"New Vienna", "New Washington", "New Waterford", "New Weston",
"Newark", "Newbury", "Newcomerstown", "Newport", "Newton Falls",
"Newtonsville", "Ney", "Niles", "North Baltimore", "North Bend",
"North Benton", "North Bloomfield", "North Fairfield",
"North Georgetown", "North Hampton", "North Jackson",
"North Kingsville", "North Lawrence", "North Lewisburg",
"North Lima", "North Olmsted", "North Ridgeville", "North Robinson",
"North Royalton", "North Star", "Northfield", "Northwood", "Norwalk",
"Norwich", "Nova", "Novelty", "Oak Harbor", "Oak Hill", "Oakwood",
"Oberlin", "Oceola", "Ohio City", "Okeana", "Okolona", "Old Fort",
"Old Washington", "Olmsted Falls", "Ontario", "Orangeville",
"Oregon", "Oregonia", "Orient", "Orrville", "Orwell", "Osgood",
"Ostrander", "Ottawa", "Ottoville", "Otway", "Overpeck",
"Owensville", "Oxford", "Painesville", "Palestine", "Pandora",
"Paris", "Parkman", "Pataskala", "Patriot", "Paulding", "Payne",
"Pedro", "Peebles", "Pemberton", "Pemberville", "Peninsula",
"Perry", "Perrysburg", "Perrysville", "Petersburg", "Pettisville",
"Phillipsburg", "Philo", "Pickerington", "Piedmont", "Pierpont",
"Piketon", "Piney Fork", "Pioneer", "Piqua", "Pitsburg",
"Plain City", "Plainfield", "Pleasant City", "Pleasant Hill",
"Pleasant Plain", "Pleasantville", "Plymouth", "Polk",
"Pomeroy", "Port Clinton", "Port Jefferson", "Port Washington",
"Port William", "Portage", "Portland", "Portsmouth", "Potsdam",
"Powell", "Powhatan Point", "Proctorville", "Prospect", "Put in Bay",
"Quaker City", "Quincy", "Racine", "Radnor", "Randolph", "Rarden",
"Ravenna", "Rawson", "Ray", "Rayland", "Raymond", "Reedsville",
"Reesville", "Reno", "Republic", "Reynoldsburg", "Richfield",
"Richmond", "Richmond Dale", "Richwood", "Ridgeville Corners",
"Ridgeway", "Rio Grande", "Ripley", "Risingsun", "Rittman",
"Robertsville", "Rock Camp", "Rock Creek", "Rockbridge", "Rockford",
"Rocky Ridge", "Rocky River", "Rogers", "Rome", "Rootstown", "Roseville",
"Rosewood", "Ross", "Rossburg", "Rossford", "Roundhead", "Rudolph",
"Rushsylvania", "Rushville", "Russells Point", "Russellville", "Russia",
"Rutland", "Sabina", "Saint Clairsville", "Saint Henry", "Saint Johns",
"Saint Louisville", "Saint Marys", "Saint Paris", "Salem", "Salesville",
"Salineville", "Sandusky", "Sandyville", "Sarahsville", "Sardinia",
"Sardis", "Savannah", "Scio", "Scioto Furnace", "Scott", "Scottown",
"Seaman", "Sebring", "Sedalia", "Senecaville", "Seven Mile", "Seville",
"Shade", "Shadyside", "Shandon", "Sharon Center", "Sharpsburg",
"Shauck", "Shawnee", "Sheffield Lake", "Shelby", "Sherrodsville",
"Sherwood", "Shiloh", "Short Creek", "Shreve", "Sidney", "Sinking Spring",
"Smithfield", "Smithville", "Solon", "Somerdale", "Somerset",
"Somerville", "South Bloomingville", "South Charleston", "South Lebanon",
"South Point", "South Salem", "South Solon", "South Vienna",
"South Webster", "Southington", "Sparta", "Spencer", "Spencerville",
"Spring Valley", "Springboro", "Springfield", "Stafford", "Sterling",
"Steubenville", "Stewart", "Stillwater", "Stockdale", "Stockport",
"Stone Creek", "Stony Ridge", "Stout", "Stoutsville", "Stow", "Strasburg",
"Stratton", "Streetsboro", "Strongsville", "Struthers", "Stryker",
"Sugar Grove", "Sugarcreek", "Sullivan", "Sulphur Springs", "Summerfield",
"Summit Station", "Summitville", "Sunbury", "Swanton", "Sycamore",
"Sycamore Valley", "Sylvania", "Syracuse", "Tallmadge", "Tarlton",
"Terrace Park", "The Plains", "Thompson", "Thornville", "Thurman",
"Thurston", "Tiffin", "Tiltonsville", "Tipp City", "Tippecanoe", "Tiro",
"Toledo", "Tontogany", "Torch", "Toronto", "Tremont City", "Trenton",
"Trimble", "Trinway", "Troy", "Tuppers Plains", "Tuscarawas", "Twinsburg",
"Uhrichsville", "Union City", "Union Furnace", "Unionport", "Uniontown",
"Unionville", "Unionville Center", "Uniopolis", "Upper Sandusky", "Urbana",
"Utica", "Valley City", "Van Buren", "Van Wert", "Vandalia", "Vanlue",
"Vaughnsville", "Venedocia", "Vermilion", "Verona", "Versailles",
"Vickery", "Vienna", "Vincent", "Vinton", "Wadsworth", "Wakefield",
"Wakeman", "Walbridge", "Waldo", "Walhonding", "Walnut Creek", "Wapakoneta",
"Warnock", "Warren", "Warsaw", "Washington Court House",
"Washingtonville", "Waterford", "Waterloo", "Watertown", "Waterville",
"Wauseon", "Waverly", "Wayland", "Wayne", "Waynesburg", "Waynesfield",
"Waynesville", "Wellington", "Wellston", "Wellsville", "West Alexandria",
"West Chester", "West Elkton", "West Farmington", "West Jefferson",
"West Lafayette", "West Liberty", "West Manchester", "West Mansfield",
"West Millgrove", "West Milton", "West Point", "West Portsmouth",
"West Rushville", "West Salem", "West Union", "West Unity", "Westerville",
"Westfield Center", "Westlake", "Weston", "Westville", "Wharton",
"Wheelersburg", "Whipple", "White Cottage", "Whitehouse", "Wickliffe",
"Wilberforce", "Wilkesville", "Willard", "Williamsburg", "Williamsfield",
"Williamsport", "Williamstown", "Williston", "Willoughby", "Willow Wood",
"Willshire", "Wilmington", "Wilmot", "Winchester", "Windham", "Windsor",
"Winesburg", "Wingett Run", "Winona", "Wolf Run", "Woodsfield",
"Woodstock", "Woodville", "Wooster", "Wren", "Xenia", "Yellow Springs",
"Yorkshire", "Yorkville", "Youngstown", "Zaleski", "Zanesfield", "Zanesville",
"Zoar"
];
$('.bslink').tip();
$("#suggest1").autocomplete(cities);
</script>

相关demo下载
补充资料
demo程序中还少一个script.do文件,并且还需要在IIS中配置“.do”的应用程序扩展,方法如下:在IIS中选择所建的网站,右键单击“属性”如下图:

(0)

相关推荐

  • ASP.NET中MVC从后台控制器传递数据到前台视图的方式

    本文实例讲述了ASP.NET中MVC从后台控制器传递数据到前台视图的方式.分享给大家供大家参考.具体分析如下: 数据存储模型Model: 复制代码 代码如下: public class CalendarEvent { public string id { get; set; } public DateTime start { get; set; } public DateTime end { get; set; } public string backgroundColor { get; set

  • Asp.Net类库中发送电子邮件的代码

    通常验证电子邮件真实有效的办法是:当用户填写的注册资料经过网站初步格式验证之后,用户并不能利用此帐号登录,系统会向用户注册时填写的电子邮件地址发送一封电子邮件,邮件中给出一个链接,只有当用户点击了这个链接之后才能登录到网站,如果用户填写的电子邮件地址不是真实有效的或者不是他本人的,就不会收到这封电子邮件,这样仍然不能登录,这一步一般称之为电子邮件激活. 在.net类库中有两种发送电子邮件的方式,一种是在.net2.0以下版本中的做法,一种是.net2.0以上版本的做法.下面分别介绍这两种办法.

  • asp.net类库中添加WebService引用出现问题解决方法

    在Web项目内添加WebService的引用是件很简单的事情,今天在类库中添加WebService引用时候,却遇到了问题,特此记录下来. 1.添加服务引用. 2.点击高级 3.添加Web引用 4.看到了就跟Web项目添加WebService一样了 添加完成后,再次点击 添加引用就出现了添加Web引用了

  • ASP.NET MVC 控制器与视图

    一.控制器相关 在Controller类中方法访问级别为public的方法,就是行为(Action).如果不希望Controller类中的方法成为Action(可以在地址栏中被访问),有两种实现方式:将方法的访问级别设置为private在方法上添加特性标记[NonAction] 诸如新增\修改等功能模块,我们往往会创建2个名称相同的Action:一个action用于加载新增\修改页面;另一个action用于处理新增\修改页面提交的表单数据.那么如何区分在何时调用哪个action呢? 我们将加载新

  • asp.net 类库中使用ConfigurationManager.ConnectionStrings

    一直没弄明白怎么在类库中找不到 ConfigurationManager.ConnectionStrings 后面才发现没有添加System.configuration的引用,添加后: 引入命名空间: 复制代码 代码如下: using System.Configuration; 便可以使用了: 复制代码 代码如下: public static string ConnectionString = ConfigurationManager.ConnectionStrings["Conn"]

  • asp.net导出Excel类库代码分享

    复制代码 代码如下: using System;using System.Collections.Generic;using System.Reflection;using System.Web;using Excel = Microsoft.Office.Interop.Excel; /// <summary>///ExcelClass 的摘要说明/// </summary>public class ExcelClass{    /// <summary>    //

  • ASP.NET MVC中将控制器分离到类库的实现

    前言 在.ASP.NET MVC的开发中,我们创建完项目之后,ASP.NET MVC是已Model-Controller-View的形式存在的,在创建项目自动生成的内容上Model我们很容易分离成类库,所以这里不予说明,那么这时候我们就像Controller是不是也能够分离出去呢?答案是肯定的,下面我们探讨一下Controller如何分离出去. 这里我提供两种分离的方法,一是重写方法继承自IControllerFactory接口,实现里面的方法,二是MVC提供了直接在路由注册里面去控制控制器的书

  • js插件类库组织与管理(基于asp.net管理)

    testjs插件类库组织与管理先举个例子,比如jquery插件中的calendar在一个页面中就得有如下代码 复制代码 代码如下: <style type="text/css"> @import ""script/calendar/jquery.datepick.css"; </style> <script type="text/javascript" src="script/jquery1.3.

  • 通过继承IHttpHandle实现JS插件的组织与管理

    如: 复制代码 代码如下: <!- Js插件 --> <script type="text/javascript" src="/scripts/popup.js"></script> <script type="text/javascript" src="/scripts/popup-util.js"></script> <!-Jquery插件 --> &

  • 基于ASP.NET+EasyUI框架实现图片上传提交表单功能(js提交图片)

    我的风格,先给大家展示下效果图,具体效果图如下所示,如果大家感觉还不错很满意请参考实现代码. HTML的代码: <form id="ff" runat="server" method="post"> <div id="content" style="margin-left:50px;"> <table style="width:300px;" id=&quo

  • 基于Marquee.js插件实现的跑马灯效果示例

    本文实例讲述了基于Marquee.js插件实现的跑马灯效果.分享给大家供大家参考,具体如下: 1.Marquee.js文件 /**************************************************************** - Marquee.js - 参数: - ID:滚动对象(必须) - Direction:滚动方向("top": 0, "up": 0, "bottom": 1, "down"

  • 纯JavaScript基于notie.js插件实现消息提示特效

    本文实例介绍了纯JavaScript实现消息提示特效是一款基于notie.js插件实现的可以制作Alert提示框,确认框和带输入的消息框,分享给大家供大家参考,具体内容如下 效果图: 实现的代码: html代码: <br><br><br><br><br><br> <article class="zzsc"> <div class="div-ext"> <div cl

  • 基于jQuery.Hz2Py.js插件实现的汉字转拼音特效

    可以实现基于jQuery实现汉字转换成拼音代码.这是一款基于jQuery.Hz2Py.js插件实现的汉字转拼音特效.插件自行下载.使用方法如下(注意修改jq的引入路径). <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>基于jQuery实现汉字转换成拼音代码</title> <

  • JS基于FileSaver.js插件实现文件保存功能示例 原创

    本文实例讲述了JS基于FileSaver.js插件实现文件保存功能.分享给大家供大家参考,具体如下: 这里介绍一款js插件用法非常简单,先来看看FileSaver.js插件源码: 复制代码 代码如下: /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ var saveAs=saveAs||function(e){"use strict";if(typeof naviga

  • JavaScript实现写入文件到本地的方法【基于FileSaver.js插件】

    本文实例讲述了JavaScript实现写入文件到本地的方法.分享给大家供大家参考,具体如下: 工作中有时需要通过 JavaScript 保存文件到本地,我们都知道 JavaScript 基于安全的考虑,是不允许直接操作本地文件的. IE 可以通过 VB 插件的方式进行,而 Chrome 和 firefox 都不支持 JavaScript 向本地写入文件,所以 VB 插件的方式存在兼容性问题. 那有没有适合的方法呢?答案是肯定的,我们可以通过 FileSaver.js 这个小插件实现我们的需求.下

  • 基于cssSlidy.js插件实现响应式手机图片轮播效果

    cssSlidy是一款支持手机移动端的焦点图轮播插件,支持标题设置,滑动动画,间隔时间等. 在线实例 实例演示 使用方法 <div id="slidy-container"> <figure id="slidy"> <a href='#' target='_blank'><img src="img/2.jpg" alt="jQuery.nicescroll美化滚动条" data-cap

  • 基于jQuery通过jQuery.form.js插件使用ajax提交form表单

    我们在提交表单的时候,如果没有使用ajax提交,页面都会自己刷新一下,显得非常的不友好,所以我们需要把我们的表单提交修改为ajax的模式,可以让用户清楚地知道他们在提交表单的时候处在哪一个阶段:正在提交?提交成功? 我简单使用了一下,jQuery Form插件有一下优点: 1.支持提交前验证. 2.支持提交后回调. 3.采用AJAX方式,有很好的用户体验 4.提交方式是灵活.只要指定要提交的form ID即可.想提交那个form.就可提交那个.同时提交参数可配置. 5.支持提交多种类型数据.如:

随机推荐