复制代码代码如下:脚本类型='text/javascript' $(文档)。ready(function() { $(')).编辑_链接').单击(函数(){ $(').text _ wrapper’).hide();定义变量数据=$('。text _ wrapper’).html();$('.编辑')。show();$('.编辑框').html(数据);$('.编辑框').焦点();});$('.编辑框').鼠标上移(function(){ return false });$('.编辑框').change(function() { $(')).编辑')。hide();var boxval=$(' .编辑框').val();var dataString=' data=' boxval$。ajax({ type: 'POST ',URL : ' update _ profile _ Ajax。PHP ',data: dataString,cache: false,success:函数(html) { $(').text _ wrapper’).html(box val);$('.text _ wrapper’).show();} });});$(文档)。mouseup(function() { $(').编辑')。hide();$('.text _ wrapper’).show();});});/script style type=' text/CSS ' body { font-family : arial,Helvetica,无衬线;font-size :12 px} .main box { width :250 pxmargin :50 px }。text _ wrapper { border : solid 1px # 0099 cc;padding:5px宽度宽度:187px}。edit_link { float:right } .editbox { overflow:隐藏;高: 61pxborder :固体1px # 0099CC宽度宽度:190 px font-size :12 px;字体系列Helvetica阿里亚尔:无衬线;padd :5 px }/style div class=' main box ' a href=' # ' class=' Edit _ link ' title=' Edit ' Edit/a?PHP包含(' db。PHP’);$sql=mysql_query('选择来自用户的电子邮件,其中user _ id=' 1 ');$ row=MySQL _ fetch _ array($ SQL);$ profile=$ row[' email '];div class='text_wrapper' style=' '?php echo $ profile?/div div class=' edit ' style=' display : none '文本区域class=' edit box ' cols=' 23 ' row=' 3 ' name=' profile _ box '/文本区域/div/div update _ profile _ Ajax。服务器端编程语言(Professional Hypertext Preprocessor的缩写)复制代码代码如下:PHP if($ _ POST[' data ']){ $ data=$ _ POST[' data '];$ data=MySQL _ escape _ String($ data);$sql='更新用户集电子邮件='$data ',其中user _ id=' 1MySQL _ query($ SQL);} ?