lrary

时光荏苒,岁月流逝,仅以此纪念那一段走过来的开发岁月,希望哪天回首时,仍能想起一幕幕难忘的日子。

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  37 随笔 :: 14 文章 :: 7 评论 :: 0 引用

公告

2006年8月18日 #

oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
    <table border oncontextmenu=return(false)><td>no</table> 可用于Table

   2. <body onselectstart="return false"> 取消选取、防止复制

  3. onpaste="return false" 不准粘贴

  4. oncopy="return false;" oncut="return false;" 防止复制

  5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标

  6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标

  7. <input style="ime-mode:disabled"> 关闭输入法

  8. 永远都会带着框架
  <script language="JavaScript"><!--
  if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页
  // --></script>

  9. 防止被人frame
  <SCRIPT LANGUAGE=JAVASCRIPT><!--
  if (top.location != self.location)top.location=self.location;
  // --></SCRIPT>

  10. 网页将不能被另存为
  <noscript><iframe src=*.html></iframe></noscript>

  11. <input type=button value=查看网页源代码
  onclick="window.location = "view-source:"+ "http://www.webjx.com"">

  12.删除时确认
  <a href="javascript:if(confirm("确实要删除吗?"))location="boos.asp?&areyou=删除&page=1"">删除</a>

  13. 取得控件的绝对位置
  //Javascript
  <script language="Javascript">
  function getIE(e){
  var t=e.offsetTop;
  var l=e.offsetLeft;
  while(e=e.offsetParent){
  t+=e.offsetTop;
  l+=e.offsetLeft;
  }
  alert("top="+t+"/nleft="+l);
  }
  </script>

  //VBScript
  <script language="VBScript"><!--
  function getIE()
  dim t,l,a,b
  set a=document.all.img1
  t=document.all.img1.offsetTop
  l=document.all.img1.offsetLeft
  while a.tagName<>"BODY"
  set a = a.offsetParent
  t=t+a.offsetTop
  l=l+a.offsetLeft
  wend
  msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"
  end function
  --></script>

  14. 光标是停在文本框文字的最后
  <script language="javascript">
  function cc()
  {
  var e = event.srcElement;
  var r =e.createTextRange();
  r.moveStart("character",e.value.length);
  r.collapse(true);
  r.select();
  }
  </script>
  <input type=text name=text1 value="123" onfocus="cc()">

  15. 判断上一页的来源
  javascript:
  document.referrer

  16. 最小化、最大化、关闭窗口
  <object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
  <param name="Command" value="Minimize"></object>
  <object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
  <param name="Command" value="Maximize"></object>
  <OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
  <PARAM NAME="Command" VALUE="Close"></OBJECT>
  <input type=button value=最小化 onclick=hh1.Click()>
  <input type=button value=最大化 onclick=hh2.Click()>
  <input type=button value=关闭 onclick=hh3.Click()>
  本例适用于IE
  

  17.屏蔽功能键Shift,Alt,Ctrl
  <script>
  function look(){
  if(event.shiftKey)
  alert("禁止按Shift键!"); //可以换成ALT CTRL
  }
  document.onkeydown=look;
  </script>

  18. 网页不会被缓存
  <META HTTP-EQUIV="pragma" CONTENT="no-cache">
  <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
  <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
  或者<META HTTP-EQUIV="expires" CONTENT="0">

  19.怎样让表单没有凹凸感?
  <input type=text style="border:1 solid #000000">
  或
  <input type=text style="border-left:none; border-right:none; border-top:none; border-bottom:

  1 solid #000000"></textarea>

  20.<div><span>&<layer>的区别?
  <div>(division)用来定义大段的页面元素,会产生转行
  <span>用来定义同一行内的元素,跟<div>的唯一区别是不产生转行
  <layer>是ns的标记,ie不支持,相当于<div>

  21.让弹出窗口总是在最上面:
  <body onblur="this.focus();">

  22.不要滚动条?
  让竖条没有:
  <body style="overflow:scroll;overflow-y:hidden">
  </body>
  让横条没有:
  <body style="overflow:scroll;overflow-x:hidden">
  </body>
  两个都去掉?更简单了
  <body scroll="no">
  </body>

  23.怎样去掉图片链接点击后,图片周围的虚线?
  <a href="#" onFocus="this.blur()"><img src="logo.jpg" border=0></a>

  24.电子邮件处理提交表单
  <form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain">
  <input type=submit>
  </form>

  25.在打开的子窗口刷新父窗口的代码里如何写?
  window.opener.location.reload()

  26.如何设定打开页面的大小
  <body onload="top.resizeTo(300,200);">
  打开页面的位置<body onload="top.moveBy(300,200);">

  27.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动
  <STYLE>
  body
  {background-image:url(logo.gif); background-repeat:no-repeat;
  background-position:center;background-attachment: fixed}
  </STYLE>

  28. 检查一段字符串是否全由数字组成
  <script language="Javascript"><!--
  function checkNum(str){return str.match(//D/)==null}
  alert(checkNum("1232142141"))
  alert(checkNum("123214214a1"))
  // --></script>

  29. 获得一个窗口的大小
  document.body.clientWidth; document.body.clientHeight

  30. 怎么判断是否是字符
  if (/[^/x00-/xff]/g.test(s)) alert("含有汉字");
  else alert("全是字符");

  31.TEXTAREA自适应文字行数的多少
  <textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">
  </textarea>
  

  32. 日期减去天数等于第二个日期
  <script language=Javascript>
  function cc(dd,dadd)
  {
  //可以加上错误处理
  var a = new Date(dd)
  a = a.valueOf()
  a = a - dadd * 24 * 60 * 60 * 1000
  a = new Date(a)
  alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日")
  }
  cc("12/23/2002",2)
  </script>

  33. 选择了哪一个Radio
  <HTML><script language="vbscript">
  function checkme()
  for each ob in radio1
  if ob.checked then window.alert ob.value
  next
  end function
  </script><BODY>
  <INPUT name="radio1" type="radio" value="style" checked>Style
  <INPUT name="radio1" type="radio" value="barcode">Barcode
  <INPUT type="button" value="check" onclick="checkme()">
  </BODY></HTML>

  34.脚本永不出错
  <SCRIPT LANGUAGE="JavaScript">
  <!-- Hide
  function killErrors() {
  return true;
  }
  window.onerror = killErrors;
  // -->
  </SCRIPT>

  35.ENTER键可以让光标移到下一个输入框
  <input onkeydown="if(event.keyCode==13)event.keyCode=9">

  36. 检测某个网站的链接速度:
  把如下代码加入<body>区域中:
  <script language=Javascript>
  tim=1
  setInterval("tim++",100)
  b=1
  var autourl=new Array()
  autourl[1]="www.webjx.net"
  autourl[2]="www.webjx.com"
  autourl[3]="www.sina.com.cn"
  autourl[4]="www.webjx.com"
  autourl[5]="www.cctv.com"
  function butt(){
  document.write("<form name=autof>")
  for(var i=1;i<autourl.length;i++)
  document.write("<input type=text name=txt"+i+" size=10 value=测试中……> =》<input type=text
  name=url"+i+" size=40> =》<input type=button value=GO

  onclick=window.open(this.form.url"+i+".value)><br>")
  document.write("<input type=submit value=刷新></form>")
  }
  butt()
  function auto(url){
  document.forms[0]["url"+b].value=url
  if(tim>200)
  {document.forms[0]["txt"+b].value="链接超时"}
  else
  {document.forms[0]["txt"+b].value="时间"+tim/10+"秒"}
  b++
  }
  function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl+"/"+Math.random()+" width=1 height=1

  onerror=auto("http://"+autourl+"")>")}
  run()</script>

  37. 各种样式的光标
  auto :标准光标
  default :标准箭头
  hand :手形光标
  wait :等待光标
  text :I形光标
  vertical-text :水平I形光标
  no-drop :不可拖动光标
  not-allowed :无效光标
  help :?帮助光标
  all-scroll :三角方向标
  move :移动标
  crosshair :十字标
  e-resize
  n-resize
  nw-resize
  w-resize
  s-resize
  se-resize
  sw-resize

posted @ 2006-08-18 15:34 lrary 阅读(107) 评论(0) 编辑

2006年6月30日 #

 
 1private void Page_Load(object sender, System.EventArgs e) 
 2    
 3      Control c3 = ParseControl("<asp:Button id='Button3' text='Btn3' commandname='Btn' commandargument='b3' runat='server' />"); 
 4      Control c4 = ParseControl("<asp:Button id='Button4' text='Btn4' commandname='Btn' commandargument='b4' runat='server' />"); 
 5      PlaceHolder2.Controls.Add(c3); 
 6      PlaceHolder2.Controls.Add(c4); 
 7      Button myBut = (Button)Page.FindControl("Button3"); 
 8      myBut.Command += new CommandEventHandler(this.OnButton); 
 9      Button myBut2 = (Button)Page.FindControl("Button4"); 
10      myBut2.Command += new CommandEventHandler(this.OnButton); 
11    }
 
12    public void OnButton(Object Sender, CommandEventArgs e) 
13    
14      switch (e.CommandArgument.ToString().ToLower()) 
15      
16        case "b0"
17          Label1.Text = "Button 0"
18          break
19        case "b1"
20          Label1.Text = "Button 1"
21          break
22        case "b3"
23          Label1.Text = "Button 3"
24          break
25        case "b4"
26          Label1.Text = "Button 4"
27          break
28      }

29    }
 
30

posted @ 2006-06-30 14:10 lrary 阅读(775) 评论(0) 编辑

2006年6月29日 #

请问如何去掉主页右面的滚动条?
<body scroll="no">
<body style="overflow-y:hidden">
********************************
怎样不使用页面的缓存?即每一次打开页面时不是调用缓存中的东西
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
********************************
请问如何忽视右键?
<body oncontextmenu="return false">
********************************
怎样在同一页面内控制不同链接的CSS属性?
a:active{}
a:link{}
a:visited{}

a.1:active{}
a.1:link{}
a.1:visited{}
在DW4的CSS中定义一个新的标示,按照HTML的语法,超级连接得是
A.YOURS:LINK A.YOURS:HOVER
YOURS可以改作你自己的字
然后在选中某个连接后,在CSS面版中点中YOURS即可。
按需要,你可以定义N个标示,N种鼠标OVER的效果
********************************
电子邮件处理提交表单
<form name="form1" method="post" action="mailto:webmaster@51js.com" enctype="text/plain">
<input type=submit>
</form>
********************************
有没有可能用层来遮住FLASH?
1.在flash的parameters里加入 <param name="wmode" value="transparent">
2.<body onblur=self.focus()>
********************************
如何根据屏幕分辨率调用相对应的页面?
onclick=alert("你的显示分辩率为:"+screen.width+"×"+screen.height)

先做好几个页面,比如一个htm1.htm是800*600,一个是htm2.htm是1024*768的
然后在你的入口页面 index.htm 中判断:
<html>
<head>
<script language=javascript>
<!--
function mHref() {
if (screen.width == 1024) location.href = "htm2.htm";
else if (screen.width == 800) location.href = "htm1.htm";
else return(false);
}
//-->
</script>
</head>
<body onload="mHref();">
</body>
</html>
********************************
如何弹出只有状态栏的窗口?
<html>
<head>
<title>open() close()</title>
<script language="javascript" type="text/javascript">
<!--
function openWin()
{
var newWin=open("","","menubar=1,height=200");
newWin.document.write("<form>");
newWin.document.write("单击以下按钮关闭窗口:<p>");
newWin.document.write("<input type=button value='关闭' onclick=window.close()>");
newWin.document.write("</form>");
}
</script></head>
<body>
<div align=center>
<h2>单击以下按钮显示新窗口...</h2>
<form name=form1>
<input type=button value="新窗口1[只显示地址栏]" onclick=window.open('','new1','location=1')>
<input type=button value="新窗口2[只显示状态栏]" onclick=window.open('','','status=1')>
<input type=button value="新窗口3[只显示工具栏]" onclick=window.open('','new2','toolbar=1,height=200,width=450')>
<input type=button value="新窗口4[只显示菜单栏]" onclick=openWin()>
<input type=button value="新窗口5[一个不少]" onclick=window.open('','new5')>
<input type=button value="新窗口6[光棍但可调大小]" onclick=window.open('http://www.51js.com/forumdisplay.php?forumid=32#thread','new6','resizable=1')>
</form>
</div>
</body>
</html>
********************************
如何让超链接没有下划线
在源代码中的<HEAD>…</HEAD>之间输入如下代码:
<style type="text/css"> <!--
a { text-decoration: none}
--> </style>
********************************
请问如何做到让一个网页自动关闭.
<html>
<head>
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
</head>
<body onload="window.setTimeout('closes.Click()',10000)">
这个窗口会在10秒过后自动关闭,而且不会出现提示. </body>
********************************
如何几秒后转到别的页面?
代码片段如下:
<META HTTP-EQUIV="Refresh" CONTENT="10;URL=http://www.51js.com">
十秒中后跳到51JS.COM的首页
********************************
怎样才能把RealPlayer文件在网页做一个试听连接?
<embed height=25 src=51js.rm type=audio/x-pn-realaudio-plugin width=50 autostart="false" controls="PlayButton">
********************************
请问如何去掉IE的上下滚动条?
<body style='overflow:scroll;overflow-y:hidden'>
</body>
********************************
解释一下event.X和event.clientX有什么区别?
event.clientX返回事件发生时,mouse相对于客户窗口的X坐标
event.X也一样
但是如果设置事件对象的定位属性值为relative
event.clientX不变
而event.X返回事件对象的相对于本体的坐标
event对象详解 ICOOE 2000.3.31 http://www.51js.com/
event代表事件的状态,例如事件发生的的元素、鼠标的位置等等,event对象只在事件过程中才有效。

event属性:

altKey
检索ALT键的当前状态
可能的值 true为关闭
false为不关闭

button
检索按下的鼠标键
可能的值: 0 没按键
1 按左键
2 按右键
3 按左右键
4 按中间键
5 按左键和中间键
6 按右键和中间键
7 按所有的键

cancelBubble
设置或检索当前事件是否将事件句柄起泡
可能的值: false 启用起泡
true 取消该事件起泡

clientX
检索与窗口客户区域有关的鼠标光标的X坐标,属性为只读,没有默认值。

clientY
检索与窗口客户区域有关的鼠标光标的Y坐标,属性为只读,没有默认值。

ctrlKey
ctrlKey 检索CTRL键的当前状态
可能的值 true为关闭
false为不关闭

dataFld
检索被oncellchange事伯影响的列

aTransfer
为拖放操作提供预先定义的剪贴板式。

Element
检索在onmouseover和onmouseout事件期间退出的对象指针

keyCode
设置或检索与引发事件的关键字相关联的Unicode关键字代码
该属性与onkeydown onkeyup onkeypress一起使用
如果没有引发事件的关键字,则该值为0

offsetX
检索与触发事件的对象相关的鼠标位置的水平坐标

offsetY
检索与触发事件的对象相关的鼠标位置的垂直坐标

propertyName
检索在对象上己更改的特性的名称

reason
检索数据源对象数据传输的结果
可能的值:
0 数据传输成功
1 数据传输失败
2 数据传输错误

recordset
检索数据源对象中默认记录集的引用
该特性为只读

repeat
检索一个事件是否被重复
该属性只有在onkeydown事件重复时才返回true

returnValue
设置或检索从事件中返回的值
可能的值:
true 事件中的值被返回
false 源对象上事件的默认操作被取消

screenX
检索与用户屏相关的鼠标的水平位置

screenY
检索与用户屏相关的鼠标的垂直位置

shiftKey
检索shiftKey键的当前状态
可能的值 true为关闭
false为不关闭

srcElement
检索触发事件的对象

srcFilter
检索导致onfilterchange事件触发的过滤器对象

srcUm
检索触发事件行为的同一资源名称
除非下面两个条件都为真,否则该特性被设置为null
1.行为被附加到触发事件的要素上
2.在前面的项目符号中定义的行为己指定了一个URN标识符和己触发的事件
toElement
检索作为onmouseover或者onmouseout事件结果而移动的对象
type
检索事件对象中的事件名称
x
检索相对于父要素鼠标水平坐标的整数
y
检索相对于父要素鼠标垂直坐标的整数
********************************************
如何让一个窗口永远在最上面?
<a onclick=aa()>点这里</a>
<script language='javascript'>
function aa(){
y=window.showModalDialog("http://www.51js.com","","Height: 300; Width: 275; help: no");
}
</script>
********************************************
target="_blank"规定链接在新窗口中打开,那 target="_parent"、 target="_self" 、target="_top"的作用又是什么?
target="_parent"、上一层框架
target="_self" 、自身窗口、框架
target="_top" 最顶层框架。
更细点的解释,从织梦补给网找来的:
_blank

開啟一個新的視窗,而且是沒有命名的視窗。

_self

強迫連結的結果顯示在同一個子畫面,而忽略 BASE 的設定。

_parent

在該子畫面的「父畫面」(也就是上一層的 FRAMESET)中顯示連結的結果。

_top

從視窗的最上頭開始顯示畫面;換句話說就是先清除整個視窗後再載入連結。
********************************************
如何使网友收藏本网时,收藏夹显示的不是微软的那个一成不变的标志,而是本人选择的ICON?
<LINK href="fav.ico" rel="shortcut icon">
加入HADE標簽中,圖片放入根目錄下,須是.ico格式.
有的空間不支援直接放在根目錄
必須加上
<LINK href="路徑/圖檔.ico" rel="shortcut icon">
********************************************
如何监听一个窗口被关闭了?
<body onunload="alert('你关闭了这个窗口')">
********************************************
什么是innerHTML、outerHTML………还有innerText?
<div id=test><table><tr><td>文本<a>链接</a>另一段文本</td></tr></table></div>
<input type=button onclick=alert(test.innerText) value="show innerText"><br>
<input type=button onclick=alert(test.innerHTML) value="show innerHTML"><br>
<input type=button onclick=alert(test.outerHTML) value="show outerHTML"><br>
********************************************
window方法列表!
发现经常有人问一些有关窗口操作的问题,
所以花了些时间整理出这篇文章,
希望以后不会再有人问这方面的问题。

ie里window的method列表

alert(sMsg)
//弹出一个确认消息框
attachEvent(sEvent,pFunction)
//绑定一个函数到某个事件,事件触发时随机执行其中一个被绑定的函数
blur()
//令窗口丧失焦点

clearInterval(iIntervalID)
//清除指定定时器的关联函数
clearTimeout(iTimeoutID)
//清除指定延时器的关联函数
close()
//关闭窗口,如果窗口不是用脚本打开的,会弹出确认对话框。
confirm([sMessage])
//弹出“确定/取消”对话框
createPopup([vArgs])
//创建一个隐藏的弹出式窗口,vArgs是未来考虑提供的参数,返回窗口句柄
detachEvent(sEvent,pFunction)
//取消一个事件的某个绑定函数
execScript(sExpression, sLanguage)
//用指定的语言执行代码
focus()
//激活窗口

moveBy(iX,iY)
//用相对方式移动窗口
moveTo(iLeft,iTop)
//用绝对方式移动窗口
navigate(sURL)
//转到指定的连接

open( [sURL] [, sName] [, sFeatures] [, bReplace])
//打开新窗口,并返回窗口句柄
//sName=(*_blank:打开一个新的未命名窗口;_parent:在父窗口中打开;_search:同时打开搜索窗口;_self:替换本窗口; _top:在顶级窗口里打开;*)
//sFeatures=(*channelmode = { yes | no | 1 | 0 };directories = { yes | no | 1 | 0 };fullscreen = { yes | no | 1 | 0 };height = number;left = number;location = { yes | no | 1 | 0 };menubar = { yes | no | 1 | 0 };resizable = { yes | no | 1 | 0 };scrollbars = { yes | no | 1 | 0 };status = { yes | no | 1 | 0 };titlebar = { yes | no | 1 | 0 };toolbar = { yes | no | 1 | 0 };top = number;width = number;*)

print()
//打印当前窗口文档内容
prompt( [sMessage] [, sDefaultValue])
//弹出输入对话框
resizeBy(iX, iY)
//以相对方式改变窗口大小
resizeTo(iWidth, iHeight)
//以绝对方式改变窗口大小

scroll(iX,iY)
滚动窗口,与scrollTo一样的效果,出于兼容性的考虑保留下来的方法
scrollBy(iX, iY)
//用相对方式滚动窗口
scrollTo(iX, iY)
//用绝对方式滚动窗口
setActive()
//激活目标而不将视线转向目标
setInterval(vCode, iMilliSeconds [, sLanguage])
//定时执行一段代码
setTimeout(vCode, iMilliSeconds, sLanguage)
//延时执行一段代码
showHelp(sURL [, vContextID])
//打开一个帮助文件,sURL为帮助文档地址,vContextID为帮助索引号
showModalDialog(sURL [, vArguments] [, sFeatures])

showModalDialog(sURL [, vArguments] [, sFeatures])
//打开一个模式对话框
//vArguments=需要向新开模式对话框传递的参数
//sFeatures=(*dialogHeight:sHeight;dialogLeft:sXPos;dialogTop:sYPos;dialogWidth:sWidth;center:{ yes | no | 1 | 0 | on | off };dialogHide:{ yes | no | 1 | 0 | on | off };edge:{ sunken | raised };help:{ yes | no | 1 | 0 | on | off };resizable:{ yes | no | 1 | 0 | on | off };scroll:{ yes | no | 1 | 0 | on | off };status:{ yes | no | 1 | 0 | on | off };unadorned:{ yes | no | 1 | 0 | on | off };*)

showModelessDialog(sURL [, vArguments] [, sFeatures])
//打开一个非模式对话框
//vArgument=需要向新开模式对话框传递的参数
//sFeatures=(*dialogHeight:sHeight;dialogLeft:sXPos;dialogTop:sYPos;dialogWidth:sWidth;center:{ yes | no | 1 | 0 | on | off };dialogHide:{ yes | no | 1 | 0 | on | off };edge:{ sunken | raised };help:{ yes | no | 1 | 0 | on | off };resizable:{ yes | no | 1 | 0 | on | off };scroll:{ yes | no | 1 | 0 | on | off };status:{ yes | no | 1 | 0 | on | off };unadorned:{ yes | no | 1 | 0 | on | off };*)
********************************************
execCommand的完全参考(中文版)
document.execCommand(sCommand[,交互方式, 动态参数])

2D-Position;document.execCommand("2D-Position","false","true");使绝对定位的对象可直接拖动;ie5.5
AbsolutePosition;document.execCommand("AbsolutePosition","false","true");使对象定位变成绝对定位;ie5.5
BackColor;document.execCommand("BackColor","false",sColor);设置背景颜色;ie4.0
BlockDirLTR;none;使块级元素排版方式为从左到右?;不支持
BlockDirRTL;none;使块级元素排版方式为从右到左?;不支持 Bold;document.execCommand("Bold","false",null);使选中区域的文字加粗;ie4.0
BrowseMode;none;设置浏览器模式?;不支持 Copy;
document.execCommand("Copy","false",null);复制选中的文字到剪贴板;ie4.0 CreateBookmark;document.execCommand("CreateBookmark","false",sAnchorName);设置指定锚点为书签;ie4.0
CreateLink;document.execCommand("CreateLink","false",sLinkURL);将选中文本变成超连接,若第二个参数为true,会出现参数设置对话框;ie4.0
Cut;document.execCommand("Cut","false",null);剪贴选中的文字到剪贴板;ie4.0
Delete;document.execCommand("Delete","false",null);删除选中的文字;ie4.0
DirLTR;none;排版方式为从左到右?;不支持 DirRTL;none;排版方式为从右到左?;不支持
EditMode;none;设置编辑模式?;不支持
FontName;document.execCommand("FontName","false",sFontName);改变选中区域的字体;ie4.0
FontSize;document.execCommand("FontSize","false",sSize|iSize);改变选中区域的字体大小;ie4.0
ForeColor;document.execCommand("ForeColor","false",sColor);设置前景颜色;ie4.0
FormatBlock;document.execCommand("FormatBlock","false",sTagName);设置当前块的标签名;ie4.0
********************************************
如何把页面加入用户的收藏夹?
<a href="javascript:window.external.AddFavorite('http://www.51js.com','无忧脚本')">收藏无忧脚本</a>
********************************************
如何让浏览器在保存页面时保存失败?
<NOSCRIPT>
<IFRAME SRC="*.html">
</IFRAME>
</NOSCRIPT>
********************************************
一个页面内所有复选框的全选功能如何实现?
<input type=checkbox><input type=checkbox>
<input type=checkbox><input type=checkbox>
<button onclick=SelectAll()>SelectAll</button>
<script>
function SelectAll()
{
var cInput=document.all.tags('INPUT');
for(var i in cInput)
if(cInput[i].type=='checkbox')cInput[i].checked=true;
}
</script>
********************************************
如何在不刷新页面的情况下刷新css?
<style>
button{ color:#000000;}
</style>
<button onclick=document.styleSheets[0].rules[0].style.color='red'>点击按钮直接修改style标签里button选择符使按钮改为红色</button>
********************************************
推荐几本asp方面的好书
初级入门
《24小时ASP》
《网页数据库设计与发布》
《asp与web数据库》 推荐

中级提高
《ASP实务经典》中国铁道出版社出版 台湾 林金霖著 48 推荐
《Active Server Pages详解》,电子工业出版社,76
《Active Server Pages 宝典》 电子工业 69元
《asp 3.0彻底研究》中国铁道出版社,廖信彦著

高级开发
《ASP3高级编程》
《Active Server Pages 3 开发指南》
********************************************
如何使用asp连接数据库?
第一种 - 这种方法用在ACCESS中最多

strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("aspfree.mdb")

set conn = server.createobject("adodb.connection")

conn.open strconn

第二种-这种方法用在SQL SERVER中多

strconn = "Driver={SQL
Server};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;PWD=Password;DATABASE=Database_Name

set conn = server.createobject("adodb.connection")

conn.open strconn

第三种

strconn="Driver={MicrosoftAccessDriver(*.mdb)};" &_

"DBQ=F:\Inetpub\wwwroot\somedir\db1.mdb;DefaultDir=f:\Inetpub\wwwroot\somedir;uid=LoginID;" &_

"pwd=Password;DriverId=25;FIL=MSAccess;" set conn = server.createobject("adodb.connection")

conn.open strconn

第四种运用系统数据源

The following uses a Data Source Name:

set conn = server.createobject("adodb.connection")

conn.open "Example"

第五种运用ODBC数据源,前提是你必须在控制面板的ODBC中设置数据源

set rs = server.createobject("adodb.recordset")

rs.open "tblname", "DSNName", 3, 3
********************************************

posted @ 2006-06-29 12:14 lrary 阅读(240) 评论(0) 编辑

2006年5月31日 #

/*
*注释添加:
∮明天去要饭
*/

SELECT

/*
* 输出格式: x年x周
* 如:200621
*/

Convert(varchar(4),intYear) +           /* 先将intYear列转成字符型 */
case when len(intWeek)=1               /* 判断intWeek列的长度是否为1 */
 then
  '0' + Convert(varchar(1),intWeek)   /* intWeek列为1位数字时转化成两位字符,最前面补0 */
  else
  Convert(varchar(2),intWeek)           /* 如果是两位则直接转成字符 */
end
as allYearWeek,                                  /* 给列取别名allYearWeek */

/*
* 输出格式: xxxx年xx周
* 如:2006年21周
*/

Convert(varchar(4),intYear) + '年' +
case when len(intWeek)=1
 then
  '0'+ Convert(varchar(1),intWeek)
 else
  Convert(varchar(2),intWeek)
end
 + '周' as DesYearWeek ,

/*
* 输出格式:x月x日~x月x日
* 如: 05.22~05.28
 */

right(replace(strWeekBeginDate,'-','.'),5) +   /* 先把替换为".",然后再取右边5位 */
'~' +
right(replace(strWeekEndDate,'-','.'),5)
as DesDate

FROM V_GetAllWeeks order by intYear Desc, intWeek Desc

输出结果:

allYearWeek      DesYearWeek               DesDate
200621                2006年21周                  05.22~05.28
200620                2006年20周                  05.15~05.21
200619                2006年19周                  05.08~05.14
200618                2006年18周                  05.01~05.07
200617                2006年17周                  04.24~04.30
200616                2006年16周                  04.17~04.23
200615                2006年15周                  04.10~04.16
200614                2006年14周                  04.03~04.09
200613                2006年13周                  03.27~04.02
200612                2006年12周                  03.20~03.26

posted @ 2006-05-31 09:58 lrary 阅读(97) 评论(0) 编辑

2006年5月30日 #

页面上:

<asp:datagrid id="DataGrid1" runat="server" AllowPaging="True" AutoGenerateColumns="False" Width="100%"
                                DataKeyField
="bh" PageSize="10" BorderWidth="1px" BorderColor="#9BA6DB">
                                
<AlternatingItemStyle CssClass="zy_tr"></AlternatingItemStyle>
                                
<ItemStyle CssClass="zy_item"></ItemStyle>
                                
<HeaderStyle CssClass="zy_title"></HeaderStyle>
                                
<Columns>
                                    
<asp:BoundColumn Visible="False" DataField="wdlb" HeaderText="序号"></asp:BoundColumn>
                                    
<asp:TemplateColumn>
                                        
<HeaderTemplate>
                                            序号
                                        
</HeaderTemplate>
                                        
<ItemTemplate>
                                            
<%# Container.DataSetIndex + 1 %>
                                        
</ItemTemplate>
                                    
</asp:TemplateColumn>
                                    
<asp:TemplateColumn HeaderText="文档名称">
                                        
<ItemTemplate>
                                            
<asp:HyperLink id="HyperLink1" runat="server">
                                                
<%# DataBinder.Eval(Container.DataItem,"wdmc")%>
                                            
</asp:HyperLink>
                                        
</ItemTemplate>
                                    
</asp:TemplateColumn>
                                    
<asp:BoundColumn DataField="ytfl" HeaderText="用途分类"></asp:BoundColumn>
                                    
<asp:BoundColumn DataField="bx_mc" HeaderText="必须"></asp:BoundColumn>
                                    
<asp:BoundColumn DataField="zt_mc" HeaderText="状态"></asp:BoundColumn>
                                    
<asp:TemplateColumn HeaderText="操作">
                                        
<ItemTemplate>
                                            
<asp:CheckBox id="record" runat="server"></asp:CheckBox>
                                        
</ItemTemplate>
                                    
</asp:TemplateColumn>
                                
</Columns>
                                
<PagerStyle Visible="False"></PagerStyle>
                            
</asp:datagrid>

后台:
 1 private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
 2         {
 3         
 4             if(e.Item.ItemType!=ListItemType.Header&&e.Item.ItemIndex>=0)
 5             {    
 6                 if(e.Item.Cells[0].Text=="1")
 7                 {
 8                     ((CheckBox)e.Item.Cells[0].FindControl("record")).Visible=true;
 9                 }
10                 else
11                 {
12                     ((CheckBox)e.Item.Cells[0].FindControl("record")).Visible=false;
13                 }
14                 try
15                 {
16                     HyperLink link1=((HyperLink)e.Item.FindControl("HyperLink1"));
17                     link1.NavigateUrl="add.aspx?bh="+DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
18                 }
19                 catch(Exception e1)
20                 {
21                     Response.Write(e1.Message.ToString());
22                 }
23     
24                 
25             }
26         }
posted @ 2006-05-30 14:34 lrary 阅读(69) 评论(0) 编辑

2006年5月16日 #

摘要: 纯脚本搞掂DataGrid表表头不动,表身滚动。先看效果: 孟子以前也做过这事,不过他的方法前台后台都要弄,还是VB的(^-^),好像也不支持像我的自动生成列的DataGrid,所以还是自己动手,纯脚本搞掂,其实很简单,就几行: functionScrollDataGrid(){vartb=document.getElementById("tbHeader");vardg=document.ge...阅读全文
posted @ 2006-05-16 09:36 lrary 阅读(126) 评论(0) 编辑

摘要: <scripttype="text/javascript">varPasswordStrength={Level:["高,实在是高","还行啦","靠,这样也行"],LevelValue:[30,20,0],//强度值Factor:[1,2,5],//字符加数,分别为字母,数字,其它KindFactor:[0,0,10,20],//密码含几种组成的加数Regex:[/[a-zA-Z]/...阅读全文
posted @ 2006-05-16 09:29 lrary 阅读(69) 评论(0) 编辑

2006年5月13日 #

摘要: 1 目的 规范数据库设计。2 概述 从数据库的设计原则 设计文档几方面论述数据库设计的规范思想及命名规则。3 数据库应用结构 根据对一般业务系统的分析,将数据库和程序系统统一进行整体描述,展示数据库的表之间以及与程序模块间的关系。 3.1 数据表和程序模块的分类 根据“处理特点”,将数据表和程序模块进行分类如下: 数据表分类:业务数据表、基本编码表、辅助编码表、系统信息表、...阅读全文
posted @ 2006-05-13 14:49 lrary 阅读(210) 评论(0) 编辑

摘要: 表Table1: 项目 金额 X1 100 X2 120 Y1 Y3 180 Y2 90 Z1 140 A1 A2 B1 300 B2 Z2 C1 150 要得到以下结果: 项目 金额 A 200 B 150 C 50 X 220 Y 270 Z 190 注:即头字母相同的累加,一个项目中如果有多于一个值则等分(如A1 A2 B1:300则A 200,B 100)。 解决方法:c...阅读全文
posted @ 2006-05-13 14:42 lrary 阅读(76) 评论(0) 编辑

2006年5月9日 #

摘要: 1privatevoidDataGrid_Join()2{3intiRow,iSpan=1,iRow_Start=0;//定义当前行数,合并行数,合并开始行标志4stringsSText,sNText;//比较源文本,比较下一文本56for(iRow=0;iRow<DataGrid1.Items.Count-1;iRow++)7{8sSText=DataGrid1.Items[iRow].C...阅读全文
posted @ 2006-05-09 21:23 lrary 阅读(95) 评论(0) 编辑

仅列出标题  下一页