第一步:创建SEQUENCE  
  create   sequence   s_country_id   increment   by   1   start   with   1   maxvalue   999999999;  
  第二步:创建一个基于该表的before   insert   触发器,在触发器中使用该SEQUENCE  
  create   or   replace   trigger   bef_ins_t_country_define  
  before   insert   on   t_country_define  
  referencing   old   as   old   new   as   new   for   each   row  
  begin  
  select   s_country_id.nextval   into   :new.country_id   from   dual;  
  end;  
(insert 时就不用关心自动增长列了)
posted @ 2008-09-27 09:32 sky-yu 阅读(94) | 评论 (1)编辑
已知有一个XML文件(bookstore.xml)如下:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon''s Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
</bookstore>

1、往<bookstore>节点中插入一个<book>节点:
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load("bookstore.xml");
XmlNode root=xmlDoc.SelectSingleNode("bookstore");//查找<bookstore>
XmlElement xe1=xmlDoc.CreateElement("book");//创建一个<book>节点
xe1.SetAttribute("genre","李赞红");//设置该节点genre属性
xe1.SetAttribute("ISBN","2-3631-4");//设置该节点ISBN属性

XmlElement xesub1=xmlDoc.CreateElement("title");
xesub1.InnerText="CS从入门到精通";//设置文本节点
xe1.AppendChild(xesub1);//添加到<book>节点中
XmlElement xesub2=xmlDoc.CreateElement("author");
xesub2.InnerText="候捷";
xe1.AppendChild(xesub2);
XmlElement xesub3=xmlDoc.CreateElement("price");
xesub3.InnerText="58.3";
xe1.AppendChild(xesub3);

root.AppendChild(xe1);//添加到<bookstore>节点中
xmlDoc.Save("bookstore.xml");
//===============================================
结果为:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon''s Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
<book genre="李赞红" ISBN="2-3631-4">
<title>CS从入门到精通</title>
<author>候捷</author>
<price>58.3</price>
</book>
</bookstore>

2、修改节点:将genre属性值为“李赞红“的节点的genre值改为“update李赞红”,将该节点的子节点<author>的文本修改为“亚胜”。
XmlNodeList nodeList=xmlDoc.SelectSingleNode("bookstore").ChildNodes;//获取bookstore节点的所有子节点
foreach(XmlNode xn in nodeList)//遍历所有子节点
{
XmlElement xe=(XmlElement)xn;//将子节点类型转换为XmlElement类型
if(xe.GetAttribute("genre")=="李赞红")//如果genre属性值为“李赞红”
{
xe.SetAttribute("genre","update李赞红");//则修改该属性为“update李赞红”

XmlNodeList nls=xe.ChildNodes;//继续获取xe子节点的所有子节点
foreach(XmlNode xn1 in nls)//遍历
{
XmlElement xe2=(XmlElement)xn1;//转换类型
if(xe2.Name=="author")//如果找到
{
xe2.InnerText="亚胜";//则修改
break;//找到退出来就可以了
}
}
break;
}
}

xmlDoc.Save("bookstore.xml");//保存。
//==================================================
最后结果为:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon''s Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
<book genre="update李赞红" ISBN="2-3631-4">
<title>CS从入门到精通</title>
<author>亚胜</author>
<price>58.3</price>
</book>
</bookstore>

3、删除 <book genre="fantasy" ISBN="2-3631-4">节点的genre属性,删除 <book genre="update李赞红" ISBN="2-3631-4">节点。
XmlNodeList xnl=xmlDoc.SelectSingleNode("bookstore").ChildNodes;

foreach(XmlNode xn in xnl)
{
XmlElement xe=(XmlElement)xn;
if(xe.GetAttribute("genre")=="fantasy")
{
xe.RemoveAttribute("genre");//删除genre属性
}
else if(xe.GetAttribute("genre")=="update李赞红")
{
xe.RemoveAll();//删除该节点的全部内容
}
}
xmlDoc.Save("bookstore.xml");
//===========================================
最后结果为:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book ISBN="2-3631-4">
<title>Oberon''s Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
<book>
</book>
</bookstore>

4、显示所有数据。
XmlNode xn=xmlDoc.SelectSingleNode("bookstore");

XmlNodeList xnl=xn.ChildNodes;

foreach(XmlNode xnf in xnl)
{
XmlElement xe=(XmlElement)xnf;
Console.WriteLine(xe.GetAttribute("genre"));//显示属性值
Console.WriteLine(xe.GetAttribute("ISBN"));

XmlNodeList xnf1=xe.ChildNodes;
foreach(XmlNode xn2 in xnf1)
{
Console.WriteLine(xn2.InnerText);//显示子节点点文本
}
}
posted @ 2008-09-20 22:48 sky-yu 阅读(15) | 评论 (0)编辑

现在做一个项目,里面用了word组件。

我在后台读取一个空word时,遇到一个问题。

在一个路径下创建一个空word文件。利用 HttpContent.Curren.Response.WriteFile(Url);可以把空word 读取出来。

但是 我想不创建word文件,直接读取一个空word,

我写了方法 HttpContent.Curren.Response.Write(new char{ });其中写了一个空流进去。

打开时弹框 ‘文件转换’ 选择打开方式。

在同事得帮助下,我明白了,打开文件时,文件是有格式头得,一堆 看不太懂得乱码。就是定义文件打开格式得。

所以最后,我还是用了自己创建一个空word得方法。

原理是这样得。我把自己搞明白得记录下来,一是给自己提醒,二是提醒不清楚的朋友。

如果谁有这方面得了解,可以和我互相交流,一起进步。

posted @ 2008-09-18 23:13 sky-yu 阅读(17) | 评论 (0)编辑
<div id="img" style="position:absolute; left:35px; top:556px; width:120; 

height:172">

<img src="injob.jpg" width=100 height=100></img>

</div>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var xPos = 20;

var yPos = document.body.clientHeight;

var step = 1;

var delay = 30;

var height = 0;

var Hoffset = 0;

var Woffset = 0;

var yon = 0;

var xon = 0;

var pause = true;

var interval;

img.style.top = yPos;

function changePos() {

width = document.body.clientWidth;

height = document.body.clientHeight;

Hoffset = img.offsetHeight;

Woffset = img.offsetWidth;

img.style.left = xPos + document.body.scrollLeft;

img.style.top = yPos + document.body.scrollTop;

if (yon) {

yPos = yPos + step;

}

else {

yPos = yPos - step;

}

if (yPos < 0) {

yon = 1;

yPos = 0;

}

if (yPos >= (height - Hoffset)) {

yon = 0;

yPos = (height - Hoffset);

}

if (xon) {

xPos = xPos + step;

}

else {

xPos = xPos - step;

}

if (xPos < 0) {

xon = 1;

xPos = 0;

}

if (xPos >= (width - Woffset)) {

xon = 0;

xPos = (width - Woffset);

}

}

function start() {

img.visibility = "visible";

interval = setInterval('changePos()', delay);

}

start();

// End -->

</script>
posted @ 2008-09-12 09:42 sky-yu 阅读(126) | 评论 (0)编辑
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>窗口模拟--Author:Vibo Email:vibo_cn@hotmail.com</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, 宋体;
font-size: 12px;
}
.webWinFrame {
position: absolute;
left:15px;
top:15px;
padding: 3px;
background-color: #EEEEEE;
}
.webWin {
width: 300px;
border: 1px solid #80C65A;
background-color: #FFFFFF;
}
.webWin .wTitle{
line-height: 18px;
padding: 2px;
font-weight: bold;
cursor:move;
background-color: #DDF8CC;
/*display:inline-block;*/
white-space: nowrap;
overflow:hidden;
text-overflow:ellipsis
}
.webWin .wContent {
overflow:hidden;
}
.webWin .wResizeBox {
background-color: #80C65A;
height: 5px;
width: 5px;
position: absolute;
right: 5px;
bottom: 5px;
overflow:hidden;
cursor:se-resize;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body>
<div class="webWinFrame" id="testWinA"><div class="webWin"><div class="wTitle">TitleA-ViboStudio</div><div class="wContent">
<!---->
<div style="width:300px;height:200px;padding:2px;">
此处显示新 Div 标签的内容此处显示新 Div 标签的内容<br>
此处显示新 Div 标签的内容此处显示新 Div 标签的内容<br>
此处显示新 Div 标签的内容<br>
此处显示新 Div 标签的内容此处显示新 Div 标签的内容<br>
此处显示新 Div 标签的内容此处显示新 Div 标签的内容<br>
此处显示新 Div 标签的内容此处显示新 Div 标签的内容<br>
此处显示新 Div 标签的内容此处显示新 Div 标签的内容<br>
</div>
<!---->
</div><div class="wResizeBox"></div></div></div>
<div class="webWinFrame" id="testWinB" style="top:110px;"><div class="webWin"><div class="wTitle">TitleB</div><div class="wContent">
<!---->
此处显示新 Div 标签的内容
此处显示新 Div 标签的内容
此处显示新 Div 标签的内容
<!---->
</div><div class="wResizeBox"></div></div></div>
</body>
</html>
<script>
window.$ = function(obj){return (document.getElementById)?document.getElementById(obj):(document.all)?document.all[obj]:obj}
window.isIE = window.Event?false:true;
window.getMouseCoords=function(e){return {x:isIE?e.clientX+Math.max(document.body.scrollLeft, document.documentElement.scrollLeft):e.pageX, y:isIE?e.clientY+Math.max(document.body.scrollTop, document.documentElement.scrollTop):e.pageY};}
window.vWinZIndex = 1;
function vDrag(o,ho,initArr){
ho=ho||o;
o.style.position="absolute";
if(!isIE){ho.firstChild.onmousedown=function(){return false;}}
ho.onmousedown=function(a){
o.style.zIndex = window.vWinZIndex;
window.vWinZIndex++;
var d=document;if(!a)a=window.event;
var x=a.layerX?a.layerX:a.offsetX,y=a.layerY?a.layerY:a.offsetY;
if(ho.setCapture)
ho.setCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
d.onmousemove=function(a){
if(!a)a=window.event;
var mus=getMouseCoords(a)
if(!a.pageX)a.pageX=mus.x;
if(!a.pageY)a.pageY=mus.y;
var tx=a.pageX-x,ty=a.pageY-y;
if(initArr){
o.style.left=(tx<initArr[0]?initArr[0]:tx>initArr[2]?initArr[2]:tx)+"px";
o.style.top=(ty<initArr[1]?initArr[1]:ty>initArr[3]?initArr[3]:ty)+"px";
}else{
o.style.left = tx+"px";
o.style.top = ty+"px";
}
};
d.onmouseup=function(){
if(ho.releaseCapture)
ho.releaseCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
d.onmousemove=null;
d.onmouseup=null;
};
};
}
function createWebWindow(o,intW,intH){
o.style.zIndex = window.vWinZIndex;
window.vWinZIndex++;
var winSelf = o.childNodes[0];
var winTitle = o.childNodes[0].childNodes[0];
var winContent = o.childNodes[0].childNodes[1];
var winDbox = o.childNodes[0].childNodes[2];
var minW =50,minH = 40;
var _self = this;
//
var wX = winSelf.offsetWidth-winContent.offsetWidth;
var wH = winSelf.offsetHeight-winContent.offsetHeight;
//
winDbox.onmousedown = function(e){
o.style.zIndex = window.vWinZIndex;
window.vWinZIndex++;
var d=document;if(!e)e=window.event;
var x=e.layerX?e.layerX:e.offsetX,y=e.layerY?e.layerY:e.offsetY;
var MCD=window.getMouseCoords(e)
winSelf.startX=MCD.x;
winSelf.startY=MCD.y;
winSelf.startW=winSelf.offsetWidth;
winSelf.startH=winSelf.offsetHeight;
//
if(winDbox.setCapture)
winDbox.setCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
d.onmousemove =function(e){
if(!e)e=window.event;
var mus=getMouseCoords(e)
var newW = (winSelf.startW +(mus.x-winSelf.startX));
var newH = (winSelf.startH +(mus.y-winSelf.startY))
resizeWin(newW,newH);
}
d.onmouseup=function(){
if(winDbox.releaseCapture)
winDbox.releaseCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
d.onmousemove=null;
d.onmouseup=null;
}
}
function resizeWin(newW,newH){
newW = newW < minW?minW:newW;
newH = newH < minH?minH:newH;
winSelf.style.width = newW+"px";
winSelf.style.height = newH+"px";
//
winTitle.style.width = isIE?newW+"px":(newW-4)+"px";
//
winContent.style.width = (newW-wX)+"px";
winContent.style.height = (newH-wH)+"px";
}
{
resizeWin(intW,intH);
vDrag(o,winTitle);
}
}
createWebWindow($("testWinA"),300,75);
createWebWindow($("testWinB"),300,100);
</script>
posted @ 2008-09-11 23:23 sky-yu 阅读(42) | 评论 (0)编辑

只要将想拖拽的对象加到一个数组里,然后调用obj_DragAndDrap.draginit(Array)及可。

<html>
<head>
<style>
<!--
.rob
{width:200px;height:200px;background:#abcabc;border:2px;position:absolute;border-color:#666666}
.child
{width:200px;height:30px;background:#bad;border:1px;}
-->
</style>
<script type="text/javascript">
function $(id){
    
return document.getElementById(id);
}
var obj_DragAndDrap = new Object();
obj_DragAndDrap 
= {
    top:
0,
    left:
0,
    dragedElement:
null,
    z_Index:
0,
    draglist:
null,
    dragstart:
function(e){
        
var event = window.event || e;
        
if(event.srcElement){
            obj_DragAndDrap.dragedElement 
= event.srcElement;
        }
else{
            obj_DragAndDrap.dragedElement 
= event.target;
        }
        
while(obj_DragAndDrap.tagName != "BODY"){
            
if(obj_DragAndDrap.isInArray(obj_DragAndDrap.draglist,obj_DragAndDrap.dragedElement)){
                
break;
            }
else{
                obj_DragAndDrap.dragedElement 
= obj_DragAndDrap.dragedElement.parentNode;
            }
        }
        obj_DragAndDrap.dragedElement.style.top 
= (obj_DragAndDrap.dragedElement.style.top)?obj_DragAndDrap.dragedElement.style.top : 0;
        obj_DragAndDrap.dragedElement.style.left 
= (obj_DragAndDrap.dragedElement.style.left)?obj_DragAndDrap.dragedElement.style.left : 0;
        obj_DragAndDrap.dragedElement.style.position 
= "absolute";
        obj_DragAndDrap.top 
= parseInt(obj_DragAndDrap.dragedElement.style.top) - event.clientY;
        obj_DragAndDrap.left 
= parseInt(obj_DragAndDrap.dragedElement.style.left) - event.clientX;
        obj_DragAndDrap.dragedElement.style.zIndex 
= obj_DragAndDrap.z_Index+1;
        obj_DragAndDrap.z_Index
++;
        obj_DragAndDrap.dragedElement.onmousemove 
= obj_DragAndDrap.draging;
        obj_DragAndDrap.dragedElement.onmouseup 
= obj_DragAndDrap.dragend;
        obj_DragAndDrap.dragedElement.onmouseout 
= obj_DragAndDrap.dragend;
    },
    draging:
function(e){
        
var event = window.event || e;
            obj_DragAndDrap.dragedElement.style.top 
= obj_DragAndDrap.top + event.clientY +"px";
            obj_DragAndDrap.dragedElement.style.left 
= obj_DragAndDrap.left + event.clientX +"px";
    },
    dragend:
function(e){
        obj_DragAndDrap.dragedElement.onmousemove 
= obj_DragAndDrap.noDrag;
        obj_DragAndDrap.dragedElement.onmouseup 
= obj_DragAndDrap.noDrag;
        obj_DragAndDrap.dragedElement.onmouseout 
= obj_DragAndDrap.noDrag;
        obj_DragAndDrap.top 
= 0;
        obj_DragAndDrap.left 
= 0;
    },
    draginit:
function(draglist){
        
try{
            
for(var i=0; i<draglist.length;i++){
                draglist[i].onmousedown 
= obj_DragAndDrap.dragstart;
            }
            obj_DragAndDrap.draglist 
= draglist;
        }
catch(exp){}
    },
    noDrag:
function(){
        
return false;
    },
    isInArray:
function(arr,ele){
        
for(var i=0 ; i < arr.length ; i++){
            
if(arr[i] == ele){
                
return true;
            }
        }
        
return false;
    }
}
function pageload(){
    
var dragment = document.getElementsByTagName("div");
    
var draglist = new Array();
    
for(var i=0;i<dragment.length;i++){
            draglist.push(dragment[i]);
    }
    
//draglist.push($("image"));
    obj_DragAndDrap.draginit(draglist);
}
 
</script>
</head>
<body onload="pageload()">
<div id="father1" class="rob" style="left:0px;top:0px">
    
<div class="child"></div>
</div>
<div id="father2" class="rob" style="left:200px;top:0px">
    
<div class="child"></div>
</div>
<div>
<img id="image" src="http://photo8.yupoo.com/20070504/023058_781786965.jpg" unselectable="on" style="border:0px;" />
</div>
</body>
</html>

posted @ 2008-09-11 13:26 sky-yu 阅读(18) | 评论 (0)编辑

 

//关闭,父窗口弹出对话框,子窗口直接关闭

this.Response.Write("<script language=javascript>window.close();</script>");

//关闭,父窗口和子窗口都不弹出对话框,直接关闭

this.Response.Write("<script>");

this.Response.Write("{top.opener =null;top.close();}");

this.Response.Write("</script>");

//弹出窗口刷新当前页面width=200 height=200菜单。菜单栏,工具条,地址栏,状态栏全没有

this.Response.Write("<script language=javascript>window.open('rows.aspx','newwindow','width=200,height=200')</script>");

//弹出窗口刷新当前页面

this.Response.Write("<script language=javascript>window.open('rows.aspx')</script>");

this.Response.Write("<script>window.open('WebForm2.aspx','_blank');</script>");

//弹出提示窗口跳到webform2.aspx页(在一个IE窗口中)

this.Response.Write(" <script language=javascript>alert('注册成功');window.window.location.href='WebForm2.aspx';</script> ");

//关闭当前子窗口,刷新父窗口

this.Response.Write("<script>window.opener.location.href=window.opener.location.href;window.close();</script>");

this.Response.Write("<script>window.opener.location.replace(window.opener.document.referrer);window.close();</script>");

//子窗口刷新父窗口

this.Response.Write("<script>window.opener.location.href=window.opener.location.href;</script>");

this.Response.Write("<script>window.opener.location.href='WebForm1.aspx';</script>");

//弹出提示窗口.确定后弹出子窗口(WebForm2.aspx)

this.Response.Write("<script language='javascript'>alert('发表成功!');window.open('WebForm2.aspx')</script>");

//弹出提示窗口,确定后,刷新父窗口

this.Response.Write("<script>alert('发表成功!');window.opener.location.href=window.opener.location.href;</script>");

//弹出相同的一页

<INPUT type="button" value="Button" onclick="javascript:window.open(window.location.href)">

//

Response.Write("parent.mainFrameBottom.location.href='yourwebform.aspx?temp=" +str+"';");

<SCRIPT LANGUAGE="javascript">

<!--

window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no') //这句要写成一行

-->

</SCRIPT>

参数解释:

<SCRIPT LANGUAGE="javascript"> js脚本开始;

window.open 弹出新窗口的命令;

'page.html' 弹出窗口的文件名;

'newwindow' 弹出窗口的名字(不是文件名),非必须,可用空''代替;

height=100 窗口高度;

width=400 窗口宽度;

top=0 窗口距离屏幕上方的象素值;

left=0 窗口距离屏幕左侧的象素值;

toolbar=no 是否显示工具栏,yes为显示;

menubar,scrollbars 表示菜单栏和滚动栏。

resizable=no 是否允许改变窗口大小,yes为允许;

location=no 是否显示地址栏,yes为允许;

status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;

</SCRIPT> js脚本结束

'newwin':隐藏菜单栏地址栏工具条

width=50:宽度

height=50:高度

scrollbars=yes/no:滚动条

top=50:窗口距离屏幕上方

left=50:窗口距离屏幕左侧

例:window.open('detail.aspx?ID="+e.Item.Cells[1].Text+"','newwin','width=750,height=600,scrollbars=yes,top=50,left=50');");

this.Response.Write("<Script>window.open('WebForm2.aspx','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=750,height=470,left=80,top=40');</script>");

例:

this.Response.Write("<script>alert('发表成功!');window.opener.location.href=window.opener.location.href;</script>");

this.Response.Write("<script>");

this.Response.Write("{top.opener =null;top.close();}");

this.Response.Write("</script>");

例: linkcolumn1.DataNavigateUrlFormatString="javascript:varwin=window.open('edit_usr.aspx?actid={0}','newwin','width=750,height=600,scrollbars=yes,top=50,left=50');window.close()";

this.Response.Write("<Script>window.open('WebForm7.aspx','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=750,height=470,left=80,top=40');</script>");

弹出跟你当前的窗口有没有菜单工具栏没有关系,你只要在页面中写一个脚本它就弹出了.比如

<a href=# onclick="window.open('xxx.aspx','窗口名称','参数');">xxxxx</a>

以下列出一些弹出窗口的参数,你可自行设定,参数之间用逗号分隔

可选。字符串--列出对象表并用逗号分开。每一项都有自己的值,他们将被分开(如:"fullscreen=yes, toolbar=yes")。下面是被支持的各种特性。

channelmode = { yes | no | 1 | 0 } 是否在窗口中显示阶梯模式。默认为no。

directories = { yes | no | 1 | 0 } 是否在窗口中显示各种按钮。默认为yes。

fullscreen = { yes | no | 1 | 0 } 是否用全屏方式显示浏览器。默认为no。使用这一特性时需要非常小心。因为这一属性可能会隐藏浏览器的标题栏和菜单,你必须提供一个按钮或者其他提示来帮助使用者关闭这一浏览窗口。ALT+F4可以关闭窗口。一个全屏窗口必须使用阶梯(channelmode)模式。

height = number 指定窗口的高度,单位是像素。最小值是100。

left = number 指定窗口距左边框的距离,单位是像素。值必须大于或者等于0。

location = { yes | no | 1 | 0 } 指定是否在窗口中显示地址栏。默认为yes。

menubar = { yes | no | 1 | 0 } 指定是否在窗口中显示菜单栏。默认为yes。

resizable = { yes | no | 1 | 0 } 指定是否在窗口中显示可供用户调整大小的句柄。默认为yes。

scrollbars = { yes | no | 1 | 0 } 指定是否在窗口中显示横向或者纵向滚动条。默认为yes。

status = { yes | no | 1 | 0 } 指定是否在窗口中显示状态栏。默认为yes。

titlebar = { yes | no | 1 | 0 } 指定是否在窗口中显示标题栏。在非调用HTML Application或者一个对话框的情况下,这一项将被忽略。默认为yes。

toolbar = { yes | no | 1 | 0 } 指定是否在窗口中显示工具栏,包括如前进、后退、停止等按钮。默认为yes。

top = number 指定窗口顶部的位置,单位是像素。值必须大于或者等于0。

width = number 指定窗口的宽度,单位是像素。最小值是100。

【1、最基本的弹出窗口代码】

<SCRIPT LANGUAGE="javascript">

<!--

window.open ('page.html')

-->

</SCRIPT>

因为这是一段javascripts代码,所以它们应该放在<SCRIPT LANGUAGE="javascript">标签和</script>之间。<!-- 和 -->是对一些版本低的浏览器起作用,在这些老浏览器中不会将标签中的代码作为文本显示出来。要养成这个好习惯啊。window.open ('page.html') 用于控制弹出新的窗口page.html,如果page.html不与主窗口在同一路径下,前面应写明路径,绝对路径(http://)和相对路径(../)均可。用单引号和双引号都可以,只是不要混用。这一段代码可以加入HTML的任意位置,<head>和</head>之间可以,<body>间</body>也可以,越前越早执行,尤其是页面代码长,又想使页面早点弹出就尽量往前放。

【2、经过设置后的弹出窗口】

下面再说一说弹出窗口的设置。只要再往上面的代码中加一点东西就可以了。我们来定制这个弹出的窗口的外观,尺寸大小,弹出的位置以适应该页面的具体情况。

<SCRIPT LANGUAGE="javascript">

<!--

window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no') //这句要写成一行

-->

</SCRIPT>

参数解释:

<SCRIPT LANGUAGE="javascript"> js脚本开始;

window.open 弹出新窗口的命令;

'page.html' 弹出窗口的文件名;

'newwindow' 弹出窗口的名字(不是文件名),非必须,可用空''代替;

height=100 窗口高度;

width=400 窗口宽度;

top=0 窗口距离屏幕上方的象素值;

left=0 窗口距离屏幕左侧的象素值;

toolbar=no 是否显示工具栏,yes为显示;

menubar,scrollbars 表示菜单栏和滚动栏。

resizable=no 是否允许改变窗口大小,yes为允许;

location=no 是否显示地址栏,yes为允许;

status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;

</SCRIPT> js脚本结束

  

【3、用函数控制弹出窗口】

下面是一个完整的代码。

<html>

<head>

<script LANGUAGE="JavaScript">

<!--

function openwin() {

window.open ("page.html", "newwindow", "height=100, width=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") //写成一行

}

//-->

</script>

</head>

<body onload="openwin()">

任意的页面内容...

</body>

</html>

  这里定义了一个函数openwin(),函数内容就是打开一个窗口。在调用它之前没有任何用途。怎么调用呢?

  方法一:<body onload="openwin()"> 浏览器读页面时弹出窗口;

方法二:<body onunload="openwin()"> 浏览器离开页面时弹出窗口;

方法三:用一个连接调用:

<a href="#" onclick="openwin()">打开一个窗口</a>

注意:使用的“#”是虚连接。

方法四:用一个按钮调用:

<input type="button" onclick="openwin()" value="打开窗口">

 

【4、同时弹出2个窗口】

对源代码稍微改动一下:

<script LANGUAGE="JavaScript">

<!--

function openwin() {

window.open ("page.html", "newwindow", "height=100, width=100, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=n o, status=no")//写成一行

window.open ("page2.html", "newwindow2", "height=100, width=100, top=1 00, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, loca tion=no, status=no")//写成一行

}

//-->

</script>

为避免弹出的2个窗口覆盖,用top和left控制一下弹出的位置不要相互覆盖即可 。最后用上面说过的四种方法调用即可。

注意:2个窗口的name(newwindows和newwindow2)不要相同,或者干脆全部为空。

【5、主窗口打开文件1.htm,同时弹出小窗口page.html】

  如下代码加入主窗口<head>区:

<script language="javascript">

<!--

function openwin() {

window.open("page.html","","width=200,height=200")

}

//-->

</script>

加入<body>区:

<a href="1.htm" onclick="openwin()">open</a>即可。

  

【6、弹出的窗口之定时关闭控制】

下面我们再对弹出的窗口进行一些控制,效果就更好了。如果我们再将一小段 代码加入弹出的页面(注意是加入page.html的HTML中,不是主页面中),让它10秒后自动关闭是不是更酷了?

首先,将如下代码加入page.html文件的<head>区:

<script language="JavaScript">

function closeit()

{

setTimeout("self.close()",10000) //毫秒

}

</script>

然后,再用<body onload="closeit()"> 这一句话代替page.html中原有的<BODY>这一句就可以了。(这一句话千万不要忘记写啊!这一句的作用是调用关闭窗口的代码,10秒钟后就自行关闭该窗口。)

【7、在弹出窗口中加上一个关闭按钮】

  <FORM>

<INPUT TYPE='BUTTON' VALUE='关闭' onClick='window.close()'>

</FORM>

呵呵,现在更加完美了!

【8、内包含的弹出窗口-一个页面两个窗口】

  上面的例子都包含两个窗口,一个是主窗口,另一个是弹出的小窗口。通过下面的例子,你可以在一个页面内完成上面的效果。

  <html>

<head>

<SCRIPT LANGUAGE="JavaScript">

function openwin()

{

OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no ,scrollbars="+scroll+",menubar=no");

//写成一行

OpenWindow.document.write("<TITLE>例子</TITLE>")

OpenWindow.document.write("<BODY BGCOLOR=#ffffff>")

OpenWindow.document.write("<h1>Hello!</h1>")

OpenWindow.document.write("New window opened!")

OpenWindow.document.write("</BODY>")

OpenWindow.document.write("</HTML>")

OpenWindow.document.close()

}

</SCRIPT>

</head>

<body>

<a href="#" onclick="openwin()">打开一个窗口</a>

<input type="button" onclick="openwin()" value="打开窗口">

</body>

</html>

  看看OpenWindow.document.write()里面的代码不就是标准的HTML吗?只要按照格式写更多的行即可。千万注意多一个标签或少一个标签就会出现错误。记得用 OpenWindow.document.close()结束啊。

【9、终极应用--弹出的窗口之Cookie控制】

  回想一下,上面的弹出窗口虽然酷,但是有一点小毛病,比如你将上面的脚本放在一个需要频繁经过的页面里(例如首页),那么每次刷新这个页面,窗口都会弹出一次,我们使用cookie来控制一下就可以了。

首先,将如下代码加入主页面HTML的<HEAD>区:

  <script>

function openwin(){

window.open("page.html","","width=200,height=200")

}

function get_cookie(Name) {

var search = Name + "="

var returnvalue = "";

if (document.cookie.length > 0) {

offset = document.cookie.indexOf(search)

if (offset != -1) {

offset += search.length

end = document.cookie.indexOf(";", offset);

if (end == -1)

end = document.cookie.length;

returnvalue=unescape(document.cookie.substring(offset, end))

}

}

return returnvalue;

}  

function loadpopup(){

if (get_cookie('popped')==''){

openwin()

document.cookie="popped=yes"

}

}

</script>

posted @ 2008-09-05 16:58 sky-yu 阅读(19) | 评论 (0)编辑
1、ACCESS数据库连接
set conn = Server.CreateObject("ADODB.Connection")
  conn.Open("driver={Microsoft Access Driver (*.mdb)};dbq=" &_
    Server.MapPath("person.mdb"))
  set rs = conn.Execute( "SELECT * FROM grade" )
  For I = 0 to rs.Fields.Count - 1  ‘得到数据表的总列数,并依次输出
    Response.Write("<LI>" & rs(I).Name & " = " & rs(I))  ’输出第一条记录
  Next
  conn.close()

2、其他数据库连接方式
访问各种数据库的时候,除了连接串不一样外,其他的操作均相同,如上面ACCESS的数据库连接串为
conn.Open("driver={Microsoft Access Driver (*.mdb)};dbq=" &_Server.MapPath("person.mdb"))

其他类型数据库的数据串:
(1)oracle
driver={microsoft ODBC for oracle}; server=服务器地址;user=;password=
driver={microsoft ODBC for oracle}; server=服务器地址;user=;password=

(2)SQL SERVER
server=服务器地址;database=数据库名;uid=用户名;pwd=''

(3)excel
driver={microsoft excel driver(*.xls)};dbq=excel文件的物理路径

(4)文本文件
driver={microsoft text driver(*.txt;*.csv)};defaultdir=文件的物理路径
posted @ 2008-08-27 16:17 sky-yu 阅读(19) | 评论 (0)编辑

     设置好一个文件夹后 
     点工具-文件夹选项-查看-应用到所有文件夹 OK

 

 

 

 

 

 

 

     Thank you for your answer zhixu

 

 转自zhixuhttp://zhidao.baidu.com/question/3255432.html

posted @ 2008-08-26 21:05 sky-yu 阅读(41) | 评论 (0)编辑

检查 XML文档没有问题,路径也没有问题 就往下看!

Load   方法将文档置入内存中并包含可用于从每个不同的格式中获取数据的重载方法。还存在   LoadXml   方法,该方法从字符串中读取   XML。  
   
  不同的   Load   方法影响在加载   XML   文档对象模型   (DOM)   时创建的节点。下表列出了一些   Load   方法的区别以及讲述这些区别的主题。   
   
LoadXml   方法,该方法从字符串中读取   XML。  
  Load   方法将文档置入内存中并包含可用于从每个不同的格式中获取数据的重载方法

 

创建空白节点:  
    用来加载   DOM   的对象对   DOM   中生成的空白和有效空白节点有影响。有关更多信息,请参见加载   DOM   时的空白和有效空白处理。  
     
  从特定节点开始加载   XML   或加载整个   XML   文档:  
    使用   System.Xml.XmlDocument.Load(System.Xml.XmlReader)   方法可以将数据从特定的节点加载到   DOM   中。有关更多信息,请参见从读取器中加载数据。  
     
  在   XML   加载时进行验证:  
    加载到   DOM   中的   XML   数据可以在加载时进行验证。使用验证   XmlReader   可以完成此操作。有关在   XML   加载时进行验证的更多信息,请参见在   DOM   中验证   XML   文档。

posted @ 2008-08-26 16:42 sky-yu 阅读(46) | 评论 (0)编辑