收藏记录

前端之家收集整理的这篇文章主要介绍了收藏记录前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

sql2005 分页必用的ROW_NUMBER() Over (order by [GID] )

{0}; select * from({1})a where RID between 1+(@PageSize*(@PageIndex-1)) and (@PageSize*@PageIndex)

/*

去掉html

*/


/// <summary>
/// 去除HTML标记
/// </summary>
/// <param name="strHtml">包括HTML的源码 </param>
/// <returns>已经去除后的文字</returns>
public string StripHTML(string strHtml)
{
string[] aryReg ={
@"<script[^>]*?>.*?</script>",

@"<(///s*)?!?((/w+:)?/w+)(/w+(/s*=?/s*(([""'])(//[""'tbnr]|[^/7])*?/7|/w+)|.{0})|/s)*?(///s*)?>",
@"([/r/n])[/s]+",
@"&(quot|#34);",
@"&(amp|#38);",
@"&(lt|#60);",
@"&(gt|#62);",
@"&(nbsp|#160);",
@"&(iexcl|#161);",
@"&(cent|#162);",
@"&(pound|#163);",
@"&(copy|#169);",
@"&#(/d+);",
@"-->",
@"<!--.*/n"

};

string[] aryRep = {
"",
"",
"/"",
"&",
"<",
">",
" ",
"/xa1",//chr(161),
"/xa2",//chr(162),
"/xa3",//chr(163),
"/xa9",//chr(169),
"/r/n",
""
};

string newReg = aryReg[0];
string strOutput = strHtml;
for (int i = 0; i < aryReg.Length; i++)
{
Regex regex = new Regex(aryReg[i],RegexOptions.IgnoreCase);
strOutput = regex.Replace(strOutput,aryRep[i]);
}

strOutput.Replace("<","");
strOutput.Replace(">","");
strOutput.Replace("/r/n","");


return strOutput;
}

/*

图片显示

*/

<style type="text/css">
#preview_wrapper{
display:inline-block;
width:200px;
height:200px;
background-color:#CCC;
}
#preview_fake{ /* 该对象用户在IE下显示预览图片 */
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
#preview_size_fake{ /* 该对象只用来在IE下获得图片的原始尺寸,无其它用途 */
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);
visibility:hidden;
}
#preview{ /* 该对象用户在FF下显示预览图片 */
width:200px;
height:200px;
}
</style>
<script language="javascript" type="text/javascript">
/*** 删除首尾空格 ***/
String.prototype.Trim = function() {
return this.replace(/(^/s*)|(/s*$)/g,"");
}



function onUploadImgChange(sender){
if( !sender.value.match( /.jpg|.gif|.png|.bmp/i ) ){
alert('图片格式无效!');
return false;
}

var objPreview = document.getElementById( 'preview' );
var objPreviewFake = document.getElementById( 'preview_fake' );
var objPreviewSizeFake = document.getElementById( 'preview_size_fake' );

if( sender.files && sender.files[0] ){
objPreview.style.display = 'block';
objPreview.style.width = 'auto';
objPreview.style.height = 'auto';

// Firefox 因安全性问题已无法直接通过 input[file].value 获取完整的文件路径
objPreview.src = sender.files[0].getAsDataURL();
}else if( objPreviewFake.filters ){
// IE7,IE8 在设置本地图片地址为 img.src 时出现莫名其妙的后果
//(相同环境有时能显示,有时不显示),因此只能用滤镜来解决
// IE7,IE8因安全性问题已无法直接通过 input[file].value 获取完整的文件路径
sender.select();
var imgSrc = document.selection.createRange().text;

objPreviewFake.filters.item(
'DXImageTransform.Microsoft.AlphaImageLoader').src = imgSrc;
objPreviewSizeFake.filters.item(
'DXImageTransform.Microsoft.AlphaImageLoader').src = imgSrc;

autoSizePreview( objPreviewFake,
objPreviewSizeFake.offsetWidth,objPreviewSizeFake.offsetHeight );
objPreview.style.display = 'none';
}
return true;
}

function onPreviewLoad(sender){
autoSizePreview( sender,sender.offsetWidth,sender.offsetHeight );
}

function autoSizePreview( objPre,originalWidth,originalHeight ){
var zoomParam = clacImgZoomParam( 200,200,originalHeight );
objPre.style.width = zoomParam.width + 'px';
objPre.style.height = zoomParam.height + 'px';
objPre.style.marginTop = zoomParam.top + 'px';
objPre.style.marginLeft = zoomParam.left + 'px';
}

function clacImgZoomParam( maxWidth,maxHeight,width,height ){
var param = { width:width,height:height,top:0,left:0 };

if( width>maxWidth || height>maxHeight ){
rateWidth = width / maxWidth;
rateHeight = height / maxHeight;

if( rateWidth > rateHeight ){
param.width = maxWidth;
param.height = height / rateWidth;
}else{
param.width = width / rateHeight;
param.height = maxHeight;
}
}

param.left = (maxWidth - param.width) / 2;
param.top = (maxHeight - param.height) / 2;

return param;
}
</script>

/*

js 转两位小数点

*/

Number(99.56565).toFixed(2);

/***是否是含有小数位的金额***/
function isMoney(sender)
{
var pattern =/^/d+[/.]?(([0-9])*)$/;
var bflag=true;

if(sender.value.Trim()=="")return false;

if(!pattern.exec(sender.value.Trim()))
{
sender.value="";
return false;
}

return true;
}

/***linq学习记录**/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LinqC
{
class Program
{
static void Main(string[] args)
{
// HasOrderBy();

GroupBy();

}

private static void HasOrderBy()
{
int[] arr = new int[] { 8,5,89,3,56,4,1,58 };
var m = from n in arr where n < 5 orderby n select n;
foreach (var n in m)
{
Console.WriteLine(n);
}
Console.ReadLine();
}

private static void GroupBy()
{
string[] languages = { "Java","C#","C++","Delphi","VB.net","VC.net","C++ Builder","Kylix","Perl","Python" };
var query = from item in languages
orderby item
group item by item.Length into lengthGroups
orderby lengthGroups.Key descending
select lengthGroups;
foreach (var item in query)
{
Console.WriteLine("strings of length {0}",item.Key);
foreach (var val in item)
{
Console.WriteLine(val);
}
}
Console.ReadLine();
}
}
}

/*********************************动态加载自定义控件**************************************/

LoadControl("Default.ascx");

原文链接:https://www.f2er.com/vb/261719.html

猜你在找的VB相关文章