C#中使用smtp发送邮件MailMessage m = new MailMessage ("jane@75271.com", "ben@75271.com", "This is the subject for the email.", "This is ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3083浏览 872个赞
C#发送HTML格式的邮件MailMessage m = new MailMessage();m.From = new MailAddress("ir@w3mentor.com", "Raja Item");m.To.Add(new MailAddress("su@w3mentor.com"……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1477浏览 1359个赞
C#发送带附件的邮件MailMessage m = new MailMessage();m.From = new MailAddress("ir@75271.com", "Raja Item");m.To.Add(new MailAddress("su@75271.com", "S……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2885浏览 715个赞
C#发送邮件并抄送给多个邮件接收者MailMessage m = new MailMessage();m.From = new MailAddress("ir@75271.com", "Raja Item");m.To.Add(new MailAddress("su@75271.com", ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2195浏览 1139个赞
C#读取命令行参数的代码下面的代码用于从命令行读取参数,参数个数不定,程序将会输出用户在命令行输入的所有参数列表using System; namespace W3M{ class ArgsExample { public static int Main(string[] args) { f……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2568浏览 2736个赞
C#创建、读取和修改Excelwindows下我们可以通过 Jet OLE DB访问Excel,就行访问数据库一样// Namespaces, Variables, and Constantsusing System;using System.Configuration;using System.Data; private OleDbData……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2695浏览 2799个赞
C#连接ODBC数据源演示代码// Namespaces, variables, and constantsusing System;using System.Configuration;using System.Data;using System.Data.Odbc; private void CButton_Click(object se……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1461浏览 419个赞
Asp.Net MVC中如果要通过ActionLink生成链接,传递参数可以通过下面的代码实现<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&qu……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2184浏览 1604个赞
ASP.NET MVC中通过Html.ActionLink动态生成链接C# MVC模式下HTML.ActionLink() 用于生成指定Action的丽娜姐,非常有用<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" ➥Inh……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1830浏览 596个赞
C#通过正则表达式去除所有html标签,只要包含在里面的都会被认为是html标签string myInput="<a href=''>clean me up</a><br/>";string strippedString = Regex.Replace(myInput,@&qu……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1408浏览 2140个赞
Convert类的静态方法FromBase64String 可以讲base64编码的字符串反转为二进制数据byte[]格式,从而恢复编码后的bitmap位图byte[] imageBytes = bmpAsString.Base64DecodeString();using (FileStream fstrm = new FileStream(@&quo……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2721浏览 1153个赞
C#解码base64编码的二进制数据通过在Convert类的静态方法Convert.FromBase64String,可以讲base64编码的字符串解码为等效的byte []数组。using System;static class MyModClass{public static byte[] Base64DecodeString(this st……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3069浏览 1601个赞
C#将一个bitmap位图通过base64编码成一个字符串byte[] image = null;using (FileStream filestrm = new FileStream(@"C:\mypic.bmp",FileMode.Open, FileAccess.Read)){ using (BinaryReader re……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2450浏览 2786个赞
C#中对二进制数据进行base64编码using System;using System.IO;static class MyModClass{public static string Base64EncodeBytes(this byte[] inBytes){return (Convert.ToBase64String(inBytes))……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2955浏览 2412个赞
C#从字符串中的指定位置移除子字符串,字符串自带remove方法可以用于删除子字符串,Remove的第一个参数为子字符串开始位置,第二个参数为要删除的子字符串长度string name = "Raja, Item";name = name.Remove(4, 1);Console.WriteLine(name); ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1945浏览 636个赞
C#查找列表中所有重复出现的元素public T[] GetDuplicates(T inputValue){ List<T> duplicates = new List<T>( ); for (int i = 0; i < this.Count; i++) { if (this[i].Equals(inputV……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1674浏览 2219个赞
这是使用linq计算元素在列表中出现的次数,调用方法非常简单,和sql语句很像// Count the number of times an item appears in this listpublic static int CountTimes<T>(this List<T> inputList, T searchItem)……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2002浏览 2876个赞
C#的Array对象自带反转功能,但是下面的代码完全通过自定义的算法来实现数组反转public static void ReverseArray<T>(this T[] inputArray){ T temp = default(T); if (inputArray == null) throw new ArgumentNull……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1994浏览 799个赞
用C#自带的函数反转数组,C#的Array对象自带反转功能,代码如下int[] someArray = new int[5] {1,2,3,4,5};Array.Reverse(someArray);……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3723浏览 1688个赞
C#获取文件创建时间,主要用到了FileInfo的CreattionTime属性using System;using System.IO;class Class1 { static void Main(string[] args) { string[] cla = Environment.GetCommandLineArgs(……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2621浏览 982个赞
C#返回目录的最后访问时间using System;using System.IO; class MainClass { static void Main(string[] args) { FileInfo file = new FileInfo("c:\\a.txt"); // Di……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2264浏览 2337个赞
C#从获取指定目录下的所有文件列表using System;using System.IO; class MainClass { static void Main(string[] args) { DirectoryInfo dir = new DirectoryInfo("c:\\"); ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2946浏览 2508个赞
JavaScript的Math对象包含了一个round方法用于对数字进行四舍五入操作,下面的代码详细演示了其用法<!DOCTYPE html><html><body><p id="demo">Click the button to round the number 2.5 to ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1906浏览 2263个赞
JS数组带有一个unshift方法可以再数组前面添加若干个元素,下面是详细的代码演示<!DOCTYPE html><html><body><p id="demo">Click the button to add elements to the array.</p>……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1900浏览 2216个赞
我们可以通过JS数组的splice方法在执行的位置插入新的元素,非常简单<!DOCTYPE html><html><body><p id="demo">Click the button to add elements to the array.</p><bu……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2940浏览 1687个赞
JS数组的sort方法支持使用函数作为参数,下面的代码演示了JS数组如何通过sort对数字类型的数组进行倒序排序<!DOCTYPE html><html><body><p id="demo">Click the button to sort the array.</p>……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2821浏览 2951个赞
JS数组的sort方法支持一个函数作为参数,下面的代码演示了JS数组如何实现数字的正序排列<!DOCTYPE html><html><body><p id="demo">Click the button to sort the array.</p><butt……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2191浏览 1888个赞
JS数组带有一个sort方法可以给数组排序,非常简单<!DOCTYPE html><html><body><p id="demo">Click the button to sort the array.</p><button onclick="my……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1970浏览 407个赞
JS数组带有一个slice方法,可以获取数组的指定部分,下面的代码获取数组中的第二个和第三个元素<!DOCTYPE html><html><body><p id="demo">Click the button to extract the second and the third……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2918浏览 2436个赞
JS中我们可以通过pop方法移除数组的最后一个元素,可以通过shift方法移除数组的第一个元素<!DOCTYPE html><html><body><p id="demo">Click the button to remove the first element of the a……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1946浏览 546个赞
下面的代码演示了JS中如果通过数组的reverse方法将数组元素反转过来<!DOCTYPE html><html><body><p id="demo">Click the button to reverse the order of the elements in the arr……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2279浏览 851个赞
下面的代码演示了JS数组通过push方法添加一个元素到数组末尾<!DOCTYPE html><html><body><p id="demo">Click the button to add a new element to the array.</p><bu……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1849浏览 2998个赞
下面的代码演示了JS数组的pop方法,可以用来移除数组的最后一个元素,实际上就是把数组当成堆栈使用<!DOCTYPE html><html><body><p id="demo">Click the button to remove the last array element.&……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3085浏览 243个赞
下面的代码演示了JS中如何通过contact函数链接多个数组<!DOCTYPE html><html><body><script>var parents = ["Jani", "Tove"];var brothers = ["Stale&quo……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2303浏览 2840个赞
下面的JS代码输出全部的cookie键值对照<!DOCTYPE html><html><body>Cookies associated with this document: <script>document.write(document.cookie);</script>&l……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1709浏览 473个赞
下面的JS代码通过document.links获得网页中的所有超级链接数组,然后获得第一个链接的ID属性<!DOCTYPE html><html><body><h1>75271.com</h1><img src ="planets.gif" width=&quo……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1827浏览 1826个赞
下面的JS代码通过document.links获取网页中的所有超级链接,从而获得超级链接的数量<!DOCTYPE html><html><body><img src ="planets.gif" width="145" height="126" ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2005浏览 224个赞
下面的代码通过document.images获取网页中的所有图片,然后获取第一个图片的id属性<!DOCTYPE html><html><body><img id="klematis lilac" border="0" src="klematis.jpg&……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1895浏览 1555个赞
下面的JS代码通过document.forms数组获取网页中的表单,并返回第一个表单的name属性,即名字<!DOCTYPE html><html><body><h1>75271.com</h1><form name="Form1"></form&g……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2996浏览 224个赞
下面的JS代码通过document.images数组获取网页中图片数量<!DOCTYPE html><html><body><h1><a href="http://www.75271.com">脚本分享网</a></h1><img bor……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2702浏览 1361个赞
下面的JS代码通过document.forms数组获得网页中表单(form)的数量<!DOCTYPE html><html><body><h1>75271.com</h1><form name="Form1"></form><form ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2124浏览 2791个赞
下面的JS代码通过document.archors数组获取第一个archor的innerHTML<!DOCTYPE html><html><body><a name="html">75271.com</a><br><a name="css……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3341浏览 201个赞
JavaScript返回网页中锚定的数目,下面的JS代码获取页面中的anchor数量<!DOCTYPE html><html><body><a name="html">HTML Tutorial</a><br><a name="css&……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2107浏览 407个赞
下面的JS代码写在iframe里面,点击按钮后整个网页会转向指定的url,而不是只转iframe里的页面<!DOCTYPE html><html><head><script>function breakout(){if (window.top!=window.self) { windo……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1591浏览 193个赞
下面的JS代码可以替换当前页面为指定的URL<!DOCTYPE html><html><head><script>function replaceDoc() { window.location.replace("http://www.75271.com") }<……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2481浏览 1787个赞