×

moveto函数 函数 window

window.moveTo这个函数只在IE里有用么?SQL Server中的时间函数有那些,最好举例说明

admin admin 发表于2022-06-26 13:39:53 浏览110 评论0

抢沙发发表评论

window.moveTo这个函数只在IE里有用么


首先回答你第一个问题:window.event代表着事件对象的状态。只有在事件发生时生效。如鼠标、键盘等事件被触发时这个对象才存在。window.event这只在IE下是这样的。他并不是标准。。也就是说其他浏览器并不支持。在W3C标准支持的浏览器下事件对向是引发事件涵数的第一个参数,参数名随意,在下面的例子中我的事件对象的参数名是evt,也可以定义为其他名字.为了兼容IE浏览器可以这样写
《style type=“text/css“》
#obj{background:red;width:300px;height:200px;position:relative;}
《/style》
《div id=“obj“》《/div》
《script type=“text/javascript“》
document.getElementById(“obj“).onclick=function(evt){
//获取的这个ID为obj的DIV对象就是个实例引起鼠标事件的元素
//evt代表事件对象(W3C DOM标准下)
var evt=evt || event; //标准化事件对象(W3C DOM 和IE DOM )
evt.Target=evt.Target || evt.srcElement;//标准化事件对象属性《引起事件的元素》
//(W3C DOM 和IE DOM )
evt.layerX=evt.layerX || evt.offsetX;//鼠标相对于引起事件的元素的父元素的X坐标(标准化IE)
evt.layerY=evt.layerY || evt.offsetY;//鼠标相对于引起事件的元素的父元素的Y坐标(标准化IE)
alert(“相对这个DIV的X方向的坐标“+evt.layerX+“\n相对这个DIV的Y方向的坐标“+evt.layerY)
}
《/script》
//以上都是手打的。。可直接保存代码部分复制到页面的body部分。在IE和FF下都可以正常执行。

SQL Server中的时间函数有那些,最好举例说明


比较常用的时间函数有DateAdd,DateDiff,DateName,DatePart,Day,Getdate,Month,Year,GetUTCDate这几个函数。
以下依次说明,如需更详细说明请参考SQL帮助文档:

1. DateAdd函数
在向指定日期加上一段时间的基础上,返回新的 datetime 值。

语法
DATEADD ( datepart , number, date )

示例
此示例打印出 pubs 数据库中标题的时间结构的列表。此时间结构表示当前发布日期加上 21 天。
SELECT DATEADD(day, 21, pubdate) AS timeframe
FROM titles

2.DateDiff函数
返回跨两个指定日期的日期和时间边界数。

语法
DATEDIFF ( datepart , startdate , enddate )

示例
此示例确定在 pubs 数据库中标题发布日期和当前日期间的天数。
SELECT DATEDIFF(day, pubdate, getdate()) AS no_of_days
FROM titles

3.DateName函数
返回代表指定日期的指定日期部分的字符串。

语法
DATENAME ( datepart , date )

示例
此示例从 GETDATE 返回的日期中提取月份名。
SELECT DATENAME(month, getdate()) AS ’Month Name’

4.DatePart函数
返回代表指定日期的指定日期部分的整数。

语法
DATEPART ( datepart , date )

示例
此示例显示 GETDATE 及 DATEPART 的输出。
SELECT DATEPART(month, GETDATE()) AS ’Month Number’

5.Day函数
返回代表指定日期的天的日期部分的整数。

语法
DAY ( date )

示例
此示例返回从日期 03/12/1998 后的天数。
SELECT DAY(’03/12/1998’) AS ’Day Number’

6.GetDate函数
按 datetime 值的 Microsoft® SQL Server™ 标准内部格式返回当前系统日期和时间。

语法
GETDATE ( )

示例
下面的示例得出当前系统日期和时间:
SELECT GETDATE()

7.Month函数
返回代表指定日期月份的整数。

语法
MONTH ( date )

示例
下面的示例从日期 03/12/1998 中返回月份数。
SELECT “Month Number“ = MONTH(’03/12/1998’)

8.Year函数
返回表示指定日期中的年份的整数。

语法
YEAR ( date )

示例
下例从日期 03/12/1998 中返回年份数。
SELECT “Year Number“ = YEAR(’03/12/1998’)

9.GetUTCDate函数
返回表示当前 UTC 时间(世界时间坐标或格林尼治标准时间)的 datetime 值。当前的 UTC 时间得自当前的本地时间和运行 SQL Server 的计算机操作系统中的时区设置。

语法
GETUTCDATE()

示例
下例从日期 03/12/1998 中返回年份数。
SELECT GETUTCDATE()

求C语言函数大全


函数名: abort
功 能: 异常终止一个进程
用 法: void abort(void);
程序例:
#include 《stdio.h》
#include 《stdlib.h》

int main(void)
{
printf(“Calling abort()\n“);
abort();
return 0; /* This is never reached */
}

函数名: abs
功 能: 求整数的绝对值
用 法: int abs(int i);
程序例:
#include 《stdio.h》
#include 《math.h》

int main(void)
{
int number = -1234;

printf(“number: %d absolute value: %d\n“, number, abs(number));
return 0;
}

函数名: absread, abswirte
功 能: 绝对磁盘扇区读、写数据
用 法: int absread(int drive, int nsects, int sectno, void *buffer);
int abswrite(int drive, int nsects, in tsectno, void *buffer);
程序例:
/* absread example */

#include 《stdio.h》
#include 《conio.h》
#include 《process.h》
#include 《dos.h》

int main(void)
{
int i, strt, ch_out, sector;
char buf;

printf(“Insert a diskette into drive A and press any key\n“);
getch();
sector = 0;
if (absread(0, 1, sector, &buf) != 0)
{
perror(“Disk problem“);
exit(1);
}
printf(“Read OK\n“);
strt = 3;
for (i=0; i《80; i++)
{
ch_out = buf[strt+i];
putchar(ch_out);
}
printf(“\n“);
return(0);
}

函数名: access
功 能: 确定文件的访问权限
用 法: int access(const char *filename, int amode);
程序例:
#include 《stdio.h》
#include 《io.h》

int file_exists(char *filename);

int main(void)
{
printf(“Does NOTEXIST.FIL exist: %s\n“,
file_exists(“NOTEXISTS.FIL“) ? “YES“ : “NO“);
return 0;
}

int file_exists(char *filename)
{
return (access(filename, 0) == 0);
}

函数名: acos
功 能: 反余弦函数
用 法: double acos(double x);
程序例:
#include 《stdio.h》
#include 《math.h》

int main(void)
{
double result;
double x = 0.5;

result = acos(x);
printf(“The arc cosine of %lf is %lf\n“, x, result);
return 0;
}

函数名: allocmem
功 能: 分配DOS存储段
用 法: int allocmem(unsigned size, unsigned *seg);
程序例:
#include 《dos.h》
#include 《alloc.h》
#include 《stdio.h》

int main(void)
{
unsigned int size, segp;
int stat;

size = 64; /* (64 x 16) = 1024 bytes */
stat = allocmem(size, &segp);
if (stat == -1)
printf(“Allocated memory at segment: %x\n“, segp);
else
printf(“Failed: maximum number of paragraphs available is %u\n“,
stat);

return 0;
}

函数名: arc
功 能: 画一弧线
用 法: void far arc(int x, int y, int stangle, int endangle, int radius);
程序例:
#include 《graphics.h》
#include 《stdlib.h》
#include 《stdio.h》
#include 《conio.h》

int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int stangle = 45, endangle = 135;
int radius = 100;

/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, ““);

/* read result of initialization */
errorcode = graphresult(); /* an error occurred */
if (errorcode != grOk)
{
printf(“Graphics error: %s\n“, grapherrormsg(errorcode));
printf(“Press any key to halt:“);
getch();

exit(1); /* terminate with an error code */
}

midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());

/* draw arc */
arc(midx, midy, stangle, endangle, radius);

/* clean up */
getch();
closegraph();
return 0;
}

函数名: asctime
功 能: 转换日期和时间为ASCII码
用 法: char *asctime(const struct tm *tblock);
程序例:
#include 《stdio.h》
#include 《string.h》
#include 《time.h》

int main(void)
{
struct tm t;
char str;

/* sample loading of tm structure */

t.tm_sec = 1; /* Seconds */
t.tm_min = 30; /* Minutes */
t.tm_hour = 9; /* Hour */
t.tm_mday = 22; /* Day of the Month */
t.tm_mon = 11; /* Month */
t.tm_year = 56; /* Year - does not include century */
t.tm_wday = 4; /* Day of the week */
t.tm_yday = 0; /* Does not show in asctime */
t.tm_isdst = 0; /* Is Daylight SavTime; does not show in asctime */

/* converts structure to null terminated
string */

strcpy(str, asctime(&t));
printf(“%s\n“, str);

return 0;
}

函数名: asin
功 能: 反正弦函数
用 法: double asin(double x);
程序例:
#include 《stdio.h》
#include 《math.h》

int main(void)
{
double result;
double x = 0.5;

result = asin(x);
printf(“The arc sin of %lf is %lf\n“, x, result);
return(0);
}

函数名: assert
功 能: 测试一个条件并可能使程序终止
用 法: void assert(int test);
程序例:
#include 《assert.h》
#include 《stdio.h》
#include 《stdlib.h》

struct ITEM {
int key;
int value;
};

/* add item to list, make sure list is not null */
void additem(struct ITEM *itemptr) {
assert(itemptr != NULL);
/* add item to list */
}

int main(void)
{
additem(NULL);
return 0;
}

函数名: atan
功 能: 反正切函数
用 法: double atan(double x);
程序例:
#include 《stdio.h》
#include 《math.h》

int main(void)
{
double result;
double x = 0.5;

result = atan(x);
printf(“The arc tangent of %lf is %lf\n“, x, result);
return(0);
}

函数名: atan2
功 能: 计算Y/X的反正切值
用 法: double atan2(double y, double x);
程序例:
#include 《stdio.h》
#include 《math.h》

int main(void)
{
double result;
double x = 90.0, y = 45.0;

result = atan2(y, x);
printf(“The arc tangent ratio of %lf is %lf\n“, (y / x), result);
return 0;
}

函数名: atexit
功 能: 注册终止函数
用 法: int atexit(atexit_t func);
程序例:
#include 《stdio.h》
#include 《stdlib.h》

void exit_fn1(void)
{
printf(“Exit function #1 called\n“);
}

void exit_fn2(void)
{
printf(“Exit function #2 called\n“);
}

int main(void)
{
/* post exit function #1 */
atexit(exit_fn1);
/* post exit function #2 */
atexit(exit_fn2);
return 0;
}

函数名: atof
功 能: 把字符串转换成浮点数
用 法: double atof(const char *nptr);
程序例:
#include 《stdlib.h》
#include 《stdio.h》

int main(void)
{
float f;
char *str = “12345.67“;

f = atof(str);
printf(“string = %s float = %f\n“, str, f);
return 0;
}

函数名: atoi
功 能: 把字符串转换成长整型数
用 法: int atoi(const char *nptr);
程序例:
#include 《stdlib.h》
#include 《stdio.h》

int main(void)
{
int n;
char *str = “12345.67“;

n = atoi(str);
printf(“string = %s integer = %d\n“, str, n);
return 0;
}

函数名: atol
功 能: 把字符串转换成长整型数
用 法: long atol(const char *nptr);
程序例:

#include 《stdlib.h》
#include 《stdio.h》

int main(void)
{
long l;
char *str = “98765432“;

l = atol(lstr);
printf(“string = %s integer = %ld\n“, str, l);
return(0);
}
-函数