一些简单常用算法整理学习
// test5.2.cpp : 定义控制台应用程序的入口点。//
// 2010.5.9
//sylar
//
#include "stdafx.h"
#include <iostream>
using namespace std;
//动态规划:0-1背包问题
//bestValue=max ( bestValue]+v ,bestValue )w<=j
//bestValue=bestValue w>j
class Knapsack
{
private:
int *weight;//物品重量数组
int *value;//物品价值数组
int numOfItems;//物品数量
int bagSpace;//背包容量
int **bestValue;//动态规划表格,记录bestValue的价值,为最优价值,i表示物品i...n装入容量为j的背包能达到的最大价值
int **path;//为了求出取得最优值时的解,记录动态规划表不同表项的选择与否
public:
//构造函数
Knapsack(int numOfItems,int bagSpace)
{
weight=new int;
value=new int;
this->bagSpace=bagSpace;
this->numOfItems=numOfItems;
bestValue=new int* ;
for(int i=0;i<numOfItems+1;i++)
{
bestValue=new int;
}
path=new int* ;
for(int i=0;i<numOfItems+1;i++)
{
path=new int;
}
}
//输入物品的重量与价值
void input()
{
int i=1;
while(i<=numOfItems)
{
cout<<"输入第"<<i<<"个物品的重量"<<endl;
cin>>weight;
cout<<"输入第"<<i<<"个物品的价值"<<endl;
cin>>value;
++i;
}
}
//动态规划核心算法
void knapsack()
{
//初始化递归最底层,即将bestValue进行初始化
for(int i=0;i<=bagSpace;i++)
{
if(weight<=i)
{
bestValue=value;
path=1;
}
else
{
bestValue=0;
path=0;
}
}
//递推的进行动态规划,自底向上,最终bestValue为1-n物品放入容量bagSpace内的最大价值
for(int k=numOfItems-1;k>=1;k--)
{
for(int j=0;j<=bagSpace;j++)
{
bestValue=bestValue;
path=0;//不放入的情况
if(weight<=j)//如果容量足够放入当前物品
{
if(bestValue]+value>bestValue)//如果放入的价值大于不放的价值
{
bestValue=bestValue]+value;
path=1;//那么就选择放入
}
}
}
}
}
//输出最大价值,并且输出选择方式
void display()
{
//打印出bestValue,表示1...numOfItems的物品装入容量为bagSpace的最大价值
int i=1;
int j=bagSpace;
cout<<"最大价值为"<<bestValue<<endl;
//根据path的记录开始,递归到path[某容量],从而打印出每个物品是否被选择进入背包
while(i<=numOfItems)
{
if(path==0)//如果i物品没被放入,看i+1个物品装入容量j背包
{
++i;
}
else
{
cout<<"<重量:"<<weight<<",价值:"<<value<<">"<<endl;
j-=weight;
++i;
}
}
}
};
/*
void main()
{
Knapsack test(5,50);//5个物品,背包容量50
test.input();//输入5个物品的价值与重量
test.knapsack();//动态规划
test.display();//打印选择与最大价值
}
*/
//动态规划:0-1背包问题
//bestValue=max ( bestValue]+v ,bestValue )w<=j
//bestValue=bestValue w>j
/*
思路总结: 看到一个题目,首先看问什么,下面以此题举例分析一下。
0-1背包问题
1,问题要求什么?
答:求把n个物品放入容量C的背包内能达到的最大价值
2,转换成一个抽象一点的数学表达式是什么?
答:bestValue,表示n个物品放入容量C的背包的最大价值
3,不考虑算法应该怎么选择,我们实际去解决这个问题的时候,是从哪里开始去做的?
答:我们有n个物品,C容量背包。于是我们开始解决问题,我先放第一个物品,如果能放进去,我就放进去,当然,我也可以不放。
第一个物品处理结束以后,我们着手于第二个物品,能放进去就放进去,当然,我们也可以不放。
所以,这就是一个决策问题,决策是从我们实际处理问题中抽象出来的,我们放物品的时候只能一个一个放,决策是放或者不放。
4,在决策了解的情况,我们应该考虑当前要求的bestValue,在决策放入或者不放入的情况,分别等于什么?
答:如果能够放入,那么我们的背包还有C-w, 物品还有n-1个,当然,我们也可以选择不放进去,那么我们背包依旧有C容量,物品还有n-1个。 所以我们修改一下我们对bestValue的定义,从而就得到了一个最优子结构的递归公式。
为了我们决策的进行,即我们每次决策都是最第i个物品进行决策,所以bestValue修改为best,表示i,i+1,i+2...n个物品放入容量为C的背包的最大价值。
所以:bestValue=max ( bestValue]+v ,bestValue )w<=j
bestValue=bestValue w>j
意思是:
如果当前容量j装不下物品i,那么i到n装入j的最大价值就等于i+1到n装入j的最大价值,就是公式的第二行。
如果当前容量j可以装下物品i,那么我们可以装进去,当然,也可以犯贱,不装进去,看看结果如何,所以i到n个物品装入j容量背包的最大价值就等于 i+1到n物品装入j-w容量的背包可以达到的最大价值+value ,i+1到n物品装入j容量背包的最大价值,这两种不同决策的一个最大值。
总结:解决什么?从哪里开始做起?有哪些决策?决策后会怎么样?
找出了递归式,它具有最优子结构性质,即可以简单的理解为:当前的最优产生于子问题的最优,然后子问题的最优不受当前最优的影响,并且通过观察递归公式,应该找到递归的最底层的i,j分别是什么,我们观察到i在逐渐增加,j在逐渐减小,所以我们在递推的时候,首先把最底层进行初始化,然后利用递归公式向上递推。 所以我们需要首先初始化bestValue,即记录第n个物品装入0到C的背包的能达到的价值,当w<=j时,bestValue等于value,如果w>j,即容量不够,那么就是0.
我们能够从底向上递推的重要原因就是:最优子结构+无后效性 。 多多体会吧。 这是基础理解了。
*/
#include <stdio.h>
int a,n,temp;
void QuickSort(int h,int t)
{
if(h>=t) return;
int mid=(h+t)/2,i=h,j=t,x;
x=a;
while(1)
{
while(a<x) i++;
while(a>x) j--;
if(i>=j) break;
temp=a;
a=a;
a=temp;
}
a=a;
a=x;
QuickSort(h,j-1);
QuickSort(j+1,t);
return;
}
/*
int main()
{
int i;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&a);
QuickSort(0,n-1);
for(i=0;i<n;i++) printf("%d ",a);
return(0);
}
*/
#include "stdafx.h"
#include<stdio.h>
#include<math.h>
#include <string.h>
#include <iostream>
using namespace std;
/*
//伪代码
//
if等于 ' '
{
直接输出5个
}
else if 不等于' '
{
if 这5个字符串是连续的
{
直接输出这5个字符
}
if 这5个字符中含有' '
{
只输出' '前面的几个字符
}
}
*/
/*
//有一个字符串,由字符和空格组成,输入一个每行最大字符数line_size,则按照每行line_size输出,不够则换行例如
//输入 abcdef ghij kl mn opqr stxyzuvwline_size=5
//输出
abcde
f
ghij
kl mn
opqr
stxyz
uvw
*/
int fun1(char* str, int line_size)
{
char *p1;
char* p2;
int i;
p1=p2 =str;
int flag = 0;
char* out = new char;
for (i = 0;i < strlen(str); i += line_size)
{
memset(out, '\0', line_size + 1);
if ( *(p1 + line_size) == ' ') ///////
{
p1 ++;
strncpy(out, p1, line_size);
cout << out;
p1 = p1 + line_size;
cout<<endl;
}
else
{
p2 = p1 + line_size;
while (*(--p2) != ' ' && p2 != p1);
if (p1 == p2)
{
strncpy(out, p1, line_size);
cout << out;
p1 = p1 + line_size;
cout<<endl;
continue;
}
else
{
strncpy(out, p1, p2 - p1);
cout << out;
p1 = p2;
cout<<endl;
continue;
}
}
}
delete [] out;
out = NULL;
return 1;
}
/*
int main()
{
//关键:每5个判断一次,判断位置信息 如果为空,跳过,如果有数字 则计算
char a = "abcdef ghij kl mn opq r stxyzuvw";
// fun(a, 5);
fun1(a, 5);
return 1;
}
*/
//输入两个整数 n 和 m,从数列1,2,3.......n 中 随意取几个数,使其和等于 m ,要求将其中所有的可能组合列出来.编程求解
//3)写出在母串中查找子串出现次数的代码.
int count1(char* str,char* s)
{
char *src = str;
char *des = s;
int times = 0;
while( *src != '\0')
{
if (*src == *des )
{
char* temp1 = src;
char* temp2 = des;
while(*temp2 != '\0'&& *(temp2++) == *(temp1++));
if(*temp2 == '\0') //如果完全匹配
{
times++; //出现次数加一
src += strlen(s);
continue;
}
}
src++;//不匹配
}
return times;
}
//2)写出二分查找的代码.
int
bfind(int* a, int len, int val)
{
int temp;
int i,j;
i = 0; j = len - 1;
//if ()
while (i <= j)
{
temp = (a + a)/2;
if (temp == val)
{
return (i + j)/2;
}
else if (temp > val)
{
j = (i + j)/2 - 1 ;
}
else if (temp < val)
{
i = (i + j)/2 + 1 ;
}
}
return -1;
}
//快速排序:
void quick_sort(int *x, int low, int high)
{
int i, j, t;
if (low < high)
{
i = low;
j = high;
t = *(x+low);
while (i<j)
{
while (i<j && *(x+j)>t)
{
j--;
}
if (i<j)
{
*(x+i) = *(x+j);
i++;
}
while (i<j && *(x+i)<=t)
{
i++;
}
if (i<j)
{
*(x+j) = *(x+i);
j--;
}
}
*(x+i) = t;
quick_sort(x,low,i-1);
quick_sort(x,i+1,high);
}
}
/*
void main()
{
int temp[] ={3,8,6,2,9,7,1};
quick_sort(temp, 0, 6);
}
*/
//快速排序:
int partition1(int* a, int begin, int end)
{
int value;
int temp;
int i, j;
int pos;
value = a;
j = end;
i = begin;
pos = begin;
if (begin == end)
{
return 1;
}
while (i < j)
{
while (a > value)j--;
while (a < value)i++;
temp = a;
a = a;
a = temp;
}
partition1(a, begin, i);
partition1(a, i, end);
return 1;
}
// max1(12, 8);
int max1(int m, int n)
{
int temp;
while (m%n != 0)
{
temp = n;
n = m%n;
m = temp;
}
return n;
}
//算法复杂度 m + n
void merge(int a[],int n,int b[],int m,int *c)
{
int i = 0;
int j = 0;
int k = 0;
while (i < n && j < m)
{
if(a < b && i < n)
{
c = a;
i++;
}
else if(a >= b && j < m)
{
c = b;
j++;
}
k++;
}
}
/*
int main()
{
int str1 ={1,3,5,7,9};
int str2 ={1,2,4,6,8};
int out;
merge(str1,5,str2,5,out);
// char a = "abcababaabc";
// /char b = "ab";
// int num = count1(a, b);
// int bf ={1,2,3,4,5,6,7,8,9,10};
// num = bfind(bf, 10, 10);
int ttt = max1(20, 12);
int a = {4,6,8,1,3,5,7,9,2,10};
partition1(a, 0 , 9);
return 1;
}
*/
//栈(数组栈,指针栈)
//来个简单的数组栈把
template<class T>
class xj_stack
{
public:
xj_stack()
{
memset(array, 0, sizeof(array));
totol_num = 0;
}
T pop_stack()
{
if (totol_num == 0)
{
return T(1);
}
return array[--totol_num];
}
int push_stack(T num)
{
array = num;
return 1;
}
int is_empty()
{
if (totol_num==0)
{
return 1;
}
return 0;
}
protected:
private:
T array;
int totol_num;
};
typedef struct _btree
{
struct _btree * left;
struct _btree * right;
int node_value;
}btree, *pbtree;
//建立一个二叉树
//
//
int create_ntree(pbtree& pnode)
{
//pbtree pnode;
int value;
cin>>value;
if (value == 0)
{
return 0;
}
pnode = new btree;
memset(pnode, '\0', sizeof(btree));
pnode->node_value = value;
create_ntree(pnode->left);
create_ntree(pnode->right);
return 1;
}
//先序遍历一个二叉树,递归实现
void pre_order(pbtree root)
{
if (root == NULL)
{
return;
}
cout<<root->node_value;
pre_order(root->left);
pre_order(root->right);
}
//先序遍历一个二叉树,非递归实现
void pre_order_ex1(pbtree root)
{
xj_stack<pbtree> m_stack;
while (root != NULL || m_stack.is_empty() != 1)
{
if (root != NULL)
{
cout<<root->node_value;
m_stack.push_stack(root);
root = root->left;
}
else
{
root = m_stack.pop_stack();
root = root->right;
}
}
}
pbtree root = NULL;
/*
void main()
{
create_ntree(root);
pre_order(root);
cout<<endl;
pre_order_ex1(root);
}
*/
//寻找第i小的数
#include <iostream>
using namespace std;
const int N=10;
int partition(int *, int,int);
void exchange(int &, int &);
int find_mid_num(int *A, int p, int r, int i){
if (p==r)
return A;
int q=partition(A, p, r);
int k=q-p+1;
if(k==i)
return A;
else if(k<i)
return find_mid_num(A, q+1,r,i-k);
else
return find_mid_num(A, p, q-1, i);
}
int partition(int *A, int p, int r){
int x=A;
int i=p-1;
for(int j=p;j<r;j++)
if(A<=x)
{
i++;
exchange(A,A);
}
exchange(A,A);
return i+1;
}
void exchange(int &x, int &y)
{
int z=x;
x=y;
y=z;
}
int main()
{
int Array={1,4,5,3,8,7,5,9,6,2};
int m=N/2;
int output=find_mid_num(Array, 0, N-1, m);
cout << output << endl;
while(1);
return 0;
}
</pre>
<p> </p>
<p> </p><div id="MySignature">sylar
QQ: 67666938
MAIL: cug@live.cn</div><div id="EntryTag">Tag标签: <a href="http://www.cnblogs.com/SuperXJ/tag/%e7%ae%97%e6%b3%95%e5%92%8c%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%84/">算法和数据结构</a></div>
<div id="digg_block">
<div id="author_profile">
<div class="author_profile_info">
<a href="http://home.cnblogs.com/SuperXJ/" target="_blank"></a>
<div class="author_profile_info">
<a href="http://home.cnblogs.com/SuperXJ/" target="_blank">sylar_xj</a><br />
关注 - 1<br />
粉丝 - 1<br />
</div>
</div>
<div class="clear"></div>
<div id="author_profile_follow"> <a href="javascript:void(0);" onclick="login();return false;">关注博主</a></div>
</div>
<div id="div_digg">
<div class="diggit" onclick="DiggIt(1730965,60494,1)">
<span class="diggnum" id="digg_count_1730965">0</span>
</div>
<div class="buryit" onclick="DiggIt(1730965,60494,2)">
<span class="burynum" id="bury_count_1730965">0</span>
</div>
<div class="clear"></div>
<span style="display:none" id="span_isdigged_1730965">0</span>
<div class="diggword" id="digg_word_1730965">(请您对文章做出评价)</div>
</div>
</div>
<div class="clear"></div>
<div id="post_next_prev">
<a href="http://www.cnblogs.com/SuperXJ/archive/2010/04/22/1718172.html">« </a> 上一篇:<a href="http://www.cnblogs.com/SuperXJ/archive/2010/04/22/1718172.html" title="发布于2010-04-22 18:53">windows mobile 通用曾抽象</a><br />
</div>
<script type="text/javascript" src="http://partner.googleadservices.com/gampad/google_service.js"></script>
<script type="text/javascript">
try {
GS_googleAddAdSenseService("ca-pub-4210569241504288");
GS_googleEnableAllServices();
}
catch (e) { }
</script>
<script type="text/javascript">
try {
GA_googleAddSlot("ca-pub-4210569241504288", "cnblogs_blogpost_body");
GA_googleAddSlot("ca-pub-4210569241504288", "cnblogs_commentbox_up");
GA_googleAddSlot("ca-pub-4210569241504288", "cnblogs_blogpost_bottom");
GA_googleAddSlot("ca-pub-4210569241504288", "cnblogs_blogpost_bottom1");
}
catch (e) { }
</script>
<script type="text/javascript">
try {
GA_googleFetchAds();
} catch (e) { }
</script>
<script type="text/javascript">
var blog_ad_has_shown = false;
var cb_c_u_id = '';
var cb_blog_uid = 'c35c2323-fc99-de11-ba8f-001cf0cd104b';
</script>
</div>
<div class="postfoot">
posted on 2010-05-09 11:52 <a href='http://www.cnblogs.com/SuperXJ/'>sylar_xj</a> 阅读(40) <a href='#commentform'>评论(0)</a> <a href="http://www.cnblogs.com/SuperXJ/admin/EditPosts.aspx?postid=1730965">编辑</a> <a href="#" onclick="AddToWz(1730965);return false;">收藏</a>
</div>
</div>
<img src ="http://www.cnblogs.com/SuperXJ/aggbug/1730965.html?type=1&webview=1" width = "1" height = "1" />
<!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
rdf:about="http://www.cnblogs.com/SuperXJ/archive/2010/05/09/1730965.html"
dc:identifier="http://www.cnblogs.com/SuperXJ/archive/2010/05/09/1730965.html"
dc:title=""
trackback:ping="http://www.cnblogs.com/SuperXJ/services/trackbacks/1730965.aspx" />
</rdf:RDF>
-->
<script type="text/javascript">
var commentAuthorHasChecked = false;
var commentAuthorIsValid = false;
var commentUrlIsValid = true;
var commentEmailIsValid = true;
var authenCodeHasChecked = false;
var authenCodeIsValid = true;
var hasLogined = false;
function PostComment() {
var isValid = true;
if($("#wrapAuthenCode").css("display")=="none"){
ShowAuthenCode();
$("#tip_AuthenCode").css("color","red");
$("#tip_AuthenCode").html("请输入验证码!");
isValid = false;
}
if(!hasLogined && !commentAuthorHasChecked){
CheckAuthor();
}
if(!hasLogined && !commentAuthorIsValid){
isValid = false;
}
if(!authenCodeHasChecked){
CheckAuthenCode();
}
if(!authenCodeIsValid){
isValid = false;
}
if(!hasLogined && !commentUrlIsValid){
isValid = false;
}
if(!commentEmailIsValid){
isValid = false;
}
if(!CheckCommentContent()){
isValid = false;
}
if(!isValid){
return;
}
var content = $("#tbCommentBody").val();
if(content.length>2000){
alert("评论内容过长!不允许发布!");
return;
}
if(content.indexOf(" E E E ")>=0){
alert("该内容不允许布!");
return;
}
if ($("#span_comment_posted").html()!='' && $("#span_comment_posted").html()==content){
alert("该评论已发表过!");
return;
}
$("#tip_comment").html("评论提交中...");
$("#span_comment_posted").html(content);
//content = content.replace("'", "\\'");
var email = $("#tbCommentEmail").val();
var authenNum = $("#tbAuthenCode").val();
var authenId = $("#span_comment_test").html();
var comment = {};
comment.authenNum = authenNum;
comment.authenId= authenId;
comment.parentId = 0;
comment.blogId = 0;
comment.sourceUrl = '';
comment.author = $("#tbCommentAuthor").val();
comment.url = $("#tbCommentAuthorUrl").val();
comment.authenCode = $("#tbAuthenCode").val();
comment.email = email;
comment.title = '';
comment.content = content;
comment.parentCommentId = $("#span_parentcomment_id").html();
$.ajax({
url: '/ws/CommentService.asmx/AddAnonymousComment',
data: $.toJSON(comment),
type: "post",
dataType: "json",
contentType: "application/json; charset=utf8",
success: function(data) {
if (data.d["IsSuccess"]) {
ShowCommentMsg("感谢您的回复:)");
//RereshComments2(comment.parentId);
$("#tbCommentBody").val('');
//$("#divCommentShow").html(data.d["ReturnData"]+content.replace(/\n/g,"<br/>")+"<br/><br/>");
$("#divCommentShow").html($("#divCommentShow").html()+data.d["ReturnData"]);
$("#tip_AuthenCode").html('');
RefreshAuthenCode();
$("#tbAuthenCode").val("");
CommentNotify(data.d["CommentID"]);
}
else {
ShowCommentMsg(data.d["ReturnData"]);//"抱歉!评论提交失败!请与管理员联系。");
$("#span_comment_posted").html('');
}
},
error: function(xhr) {
ShowCommentMsg("抱歉!评论提交失败!请与管理员联系。");
$("#span_comment_posted").html('');
//alert(xhr.responseText);
}
}
);
}
function RefreshAuthenCode(){
AjaxPost("/ws/CommentService.asmx/RefreshAuthenCode","{}",RefreshImg);
$("#lnkRereshAuthenCode").html("<span style='color:red'>刷新中...</span>");
return false;
}
function RefreshImg(response){
$("#imgAuthenCode").attr("src","/Modules/CaptchaImage/ValidCodeImage.aspx?id="+encodeURIComponent(response));
$("#span_comment_test").html(response);
$("#lnkRereshAuthenCode").html("看不清,换一个");
}
function ShowAuthenCode(){
//if($("#wrapAuthenCode").css("display")=="none"){
// AjaxPost("/ws/CommentService.asmx/RefreshAuthenCode","{}",ShowAuthenCodeOk);
//}
$("#wrapAuthenCode").show();
}
function ShowAuthenCodeOk(response){
UpdateAuthenCode();
$("#tbAuthenCode").val("");
$("#wrapAuthenCode").show();
$("#tip_AuthenCode").html('');
}
function CheckAuthor(isOnblur){
commentAuthorHasChecked = true;
var maxLength = 30;
if($("#tbCommentAuthor").val().length == 0){
$("#tip_author").html("请输入您的昵称!");
commentAuthorIsValid = false;
return false;
}
else if($("#tbCommentAuthor").val().length > maxLength){
$("#tip_author").html("昵称不允许超过" + maxLength + "个字符!");
commentAuthorIsValid = false;
return false;
}
else{
//if(isOnblur){
AjaxPost("/ws/CommentService.asmx/IsAuthorExist","{author:'"+$("#tbCommentAuthor").val()+"'}" ,OnCheckAuthorExist);
//}
//else{
// $("#tip_author").html("");
// commentAuthorIsValid = true;
//}
return true;
}
}
function OnCheckAuthorExist(response){
if(!response){
$("#tip_author").html("");
commentAuthorIsValid = true;
}
else{
$("#tip_author").html("该昵称已被使用,请更换昵称");
commentAuthorIsValid = false;
}
}
function CheckUrl(){
var maxLength = 50;
var url = $("#tbCommentAuthorUrl").val();
if(url.length == 0){
commentUrlIsValid = true;
return true;
}
else if(url.length > maxLength){
$("#tip_url").html("主页地址不允许超过" + maxLength + "个字符!");
commentUrlIsValid = false;
return false;
}
else if(url.indexOf("http://")!=0 || url.indexOf(".") < 0){
$("#tip_url").html("主页地址要以“http://”开头");
commentUrlIsValid = false;
return false;
}
else{
$("#tip_url").html("");
commentUrlIsValid = true;
return true;
}
}
function CheckEmail(){
var email = $("#tbCommentEmail").val();
if(email.length>0){
var regExp = new RegExp("\\w+@((\\w|\-)+\\.)+{2,3}");
if(!regExp.test(email)){
$("#tip_email").html("请输入正确的邮件地址!");
commentEmailIsValid = false;
}
else{
commentEmailIsValid = true;
$("#tip_email").html("");
}
}
else{
commentEmailIsValid = true;
$("#tip_email").html("");
}
}
function CheckAuthenCode(){
authenCodeHasChecked = true;
var num = $("#tbAuthenCode").val();
var id = $("#span_comment_test").html();
$("#tip_AuthenCode").css("color","red");
if(num.length==0){
authenCodeIsValid = false;
$("#tip_AuthenCode").html("请输入验证码!");
return;
}
else if(num.length!=4){
authenCodeIsValid = false;
$("#tip_AuthenCode").html("请输入四位数字!");
return;
}
else if(new RegExp("(\d+)").test(num)){
authenCodeIsValid = false;
$("#tip_AuthenCode").html("请输入四位数字!");
return;
}
else{
AjaxPost("/ws/CommentService.asmx/CheckAuthenCode","{number:"+num+",id:'"+id+"'}", OnCheckAuthenCode);
}
}
function OnCheckAuthenCode(response){
if(response){
$("#tip_AuthenCode").css("color","green");
$("#tip_AuthenCode").html("验证码输入正确!");
authenCodeIsValid = true;
}
else{
$("#tip_AuthenCode").css("color","red");
$("#tip_AuthenCode").html("验证码输错啦!");
RefreshAuthenCode();
authenCodeIsValid = false;
}
}
function CheckCommentContent(){
if($("#tbCommentBody").val().length==0){
alert("请输入评论内容!");
return false;
}
return true;
} 多谢多谢啦 谢谢分享!!C++这论坛资料也是很少的 回复 1# xaut3
学习学习了。 学习一下! 谢谢了 以后可能会用到
页:
[1]