asp实现GET方法提交数据

get方法主要用于少量数据传输

主要利用Request.querystring(“表单对象名称”)来接受数据


1_1.htm:

<html>
<head>
<title>GET方法提交数据</title>
</head>
<body>
<p align="center" ><font color=red>GET方法提交数据</font></p>
<form name="bd" method="get" action="1_1.asp">
<table width="100%" border="0" cellpadding="0" cellspacing="">
<tr><td width="50%" align="right" valign="middle" height="37"><font color=red>*</font>用户名:</td>
<td width="50%" align="left" valign="middle" height="37"><input type="text" name="yh" size="17"></td></tr>
<tr><td width="50%" align="right" valign="middle" ><font color=red>*</font>密码:</td>
<td width="50%" align="left" valign="middle"><input type="password" name="mm" size="18"></td></tr>
<tr><td width="50%" align="right" valign="middle" ><font color=red>*</font>确认密码:</td>
<td width="50%" align="left" valign="middle"><input type="password" name="qm" size="18"></td></tr>
<tr><td width="50%" align="right" valign="middle" ><font color=red>*</font>姓名:</td>
<td width="50%" align="left" valign="middle"><input type="text" name="xm" size="17"></td></tr>
<tr><td width="50%" align="right" valign="middle" ><font color=red>*</font>职业:</td><td align="left" valign="middle"><select name="xl" size="1">
<option value="1">学生
<option value="2">工人
<option value="3">教师
<option value="4">工程师
</select></td>
<tr><td width="50%" align="right" valign="middle"><font color=red>*</font>E-mail地址:</td>
<td width="50%" align="left" valign="middle"><input type="text" name="em" size="17"></td></tr>
<tr><td width="50%" align="right" valign="middle"><font color=red>*</font>地址:</td>
<td width="50%" align="left" valign="middle"><input type="text" name="dz" size="17"></td></tr>
<tr><td width="50%" align="right" valign="middle"><font color=red>*</font>电话:</td>
<td width="50%" align="left" valign="middle"><input type="text" name="dh" size="17"></td></tr>
<tr><td align="right"><input type="submit" name="tj" value="提交"></td>
<td align="left"><input type="Reset" name="qx" value="取消"></td></tr>
</table>
</form>
</body>
</html>

1_1.asp

<%language="vbscript"%>
<html>
<head>
</head>
<title>GET方法提交数据</title>
<body>
<% Dim a,b,c,d,e,f,g
a=Request.querystring("yh")
b=Request.querystring("mm")
c=Request.querystring("qm")
d=Request.querystring("xm")
e=Request.querystring("em")
f=Request.querystring("dz")
g=Request.querystring("dh")

Response.Write "用户名:"&a&"<br>"
Response.Write "密码:"&b&"<br>"
Response.Write "确认密码:"&c&"<br>"
Response.Write "姓名:"&d&"<br>"
Response.Write "职业:"&e&"<br>"
Response.Write "地址:"&f&"<br>"
Response.Write "电话:"&g&"<br>"
%>
</body>
</html>

链栈的实现

链栈由以下2个操作:入栈操作和出栈操作,创建2个函数,具体实现在下面:


#include <stdio.h>
#include <malloc.h>
typedef struct Node
{
char data;
struct Node *next;
}LstNode;

typedef LstNode *LStack;

LStack Push(LStack top,char x)
{
LstNode *temp;
temp=(LstNode*)malloc(sizeof(LstNode));
if(temp==NULL)
{
   printf("申请空间失败");
}
temp->data=x;
temp->next=top->next;
top->next=temp;
return (top);
}

char Pop(LStack top)
{
char x;
LstNode *temp;
if(top->next==NULL)
{
   printf("栈空无法出栈");
}
temp=top->next;
x=temp->data;
top->next=temp->next;
free(temp);
return (x);
}

main()
{
LStack LT;
char c;
LT=(LStack)malloc(sizeof(LstNode));
LT->next=NULL;
printf("请输入入栈字符:\n");
while((c=getchar())!='\n')
{
   LT=Push(LT,c);
}
printf("输出出栈字符:\n");
do
{
   c=Pop(LT);
   putchar(c);
}while(LT->next!=NULL);
printf("\n");
}
实现如下
链栈的实现
链栈的实现

顺序栈的实现

顺序栈由以下2个操作:入栈操作和出栈操作,创建2个函数,具体实现在下面:


#include<stdio.h>
#include <malloc.h>
#define TRUE 1
#define FALSE 0
#define Stack_Size 50

typedef struct
{
char elem[Stack_Size];
int top;
}SeqStack;

int Push(SeqStack *S,char x)
{
if(S->top==Stack_Size-1)
   printf("栈已满无法进栈");
   S->top++;
   S->elem[S->top]=x;
   return (TRUE);
}
int Pop(SeqStack *S,char *x)
{
if(S->top==-1)
{
   printf("栈空无法出栈");
   return (FALSE);
}
else
{
   *x=S->elem[S->top];
   S->top--;
   return (TRUE);
}
}
void main()
{
SeqStack *ST;
char c1,*c2;
ST=(SeqStack*)malloc(sizeof(SeqStack));
c2=(char*)malloc(sizeof(SeqStack));
ST->top=-1;
printf("请输入字符:\n");
while((c1=getchar())!='\n')
{
   Push(ST,c1);
}
printf("输出出栈字符为:\n");
do
{
   Pop(ST,c2);
   putchar(*c2);
}
while(ST->top!=-1);

printf("\n");
}
实现如下
顺序栈的实现
顺序栈的实现

链队列的实现

链队列由以下2个操作:入队算法和出队算法,创建2个函数,具体实现在下面:


#include <stdio.h>
#include <malloc.h>
#define NULL 0
#define true 1
#define false 0
typedef struct Node
{
char data;
struct Node *next;
}LinkQueueNode;
typedef struct
{
LinkQueueNode *front;
    LinkQueueNode *rear;
}LinkQueue;
int EnQueue(LinkQueue *q,char x)
{
LinkQueueNode *p;
p=(LinkQueueNode *)malloc(sizeof(LinkQueueNode));
if(p)
{
   p->data=x;
   p->next=NULL;
   q->rear->next=p;
   q->rear=p;
   return (true);
}
else
   return (false);

}
int Del_Q(LinkQueue *q,char *x)
{
LinkQueueNode *p;
p=(LinkQueueNode *)malloc(sizeof(LinkQueueNode));
if(q->front==q->rear)
   return (false);
p=q->front->next;
q->front->next=p->next;
if(q->rear==p)
   q->rear=q->front;
*x=p->data;
free(p);
return (true);
}
main()
{
LinkQueue *Q;
Q=(LinkQueue *)malloc(sizeof(LinkQueue));
Q->front=(LinkQueueNode *)malloc(sizeof(LinkQueueNode));
Q->rear=Q->front;
char x;
printf("输入入队的字符顺序:\n");
while((x=getchar())!='\n')
   EnQueue(Q,x);
printf("出队顺序:\n");
while(Del_Q(Q,&x))
{
   putchar(x);
}
printf("\n");
}
实现效果如下
链队列的实现
链队列的实现