怎么样能够实现这样的效果?
|--------|
|--------|(input text) button怎样实现点击button,把text的数据提交给数据中,实现无刷新数据更新?
|--------|
|--------|(input text) button怎样实现点击button,把text的数据提交给数据中,实现无刷新数据更新?
解决方案 »
- 如何用PHP获取远程大文件的大小呢??
- 怎么批量判断pdf文章是否已损坏?
- 问个 字符过滤的问题!!!!
- 求个VIM的自动缩进功能的编辑器
- 求一段采集正则表达式
- wordpress 的函数都在哪些文件里定义的啊 ?怎么找不到啊
- ecshop后台添加商品相册的时候bmp格式的无法生成缩略图
- 织梦怎么写添加图片 的后台
- fwrite(): send of 16 bytes failed with errno=1 Operation not permitted
- 急求导入图片到mysql,怎么导?在线等,恳求大神相助
- window 2003 下装了apache 但没有办法使用shtml
- preg_match_all动态匹配邮件问题
<?php
foreach($results as $rs){
$id=$rs->id;
$login=$rs->login;
//get names by id
$name=$tool->get_col_value("users","name","login='$login'");
$surname=$tool->get_col_value("users","surname","login='$login'");
$user_type=$tool->get_col_value("users","user_type","login='$login'");
$email=$tool->get_col_value("users","email","login='$login'");
$join_date=$rs->join_date;
$line_id="line".$id; }
?>
<tr <?php echo "id='$line_id'"; ?> >
<td height="25" style="padding-left:5px;" ><div align="right"><b><?php echo $login; ?></b></a></div></td>
<td height="25" align="center" > <?php echo $name; ?></td>
<td align="center"><?php echo $surname; ?></td>
<td align="center"> <?php echo $id; ?></td>
<td width="13%" height="25" align="center" ><input height="20" width="80" name="<?php echo "score".$i;?>" type="text" value="<?php echo $class_score; ?>" /></td>
<td width="5%" align="center" ><?php echo $active_score; ?></td>
<td height="25" align="center" <?php echo $text_color_class; ?> ><?php echo $active_img; ?></td>
</tr><?php $i++;} ?>
</form>
<td height="25" style="padding-left:5px;" > <div align="right"> <b> <?php echo $login; ?> </b> </a> </div> </td>
<td height="25" align="center" > <?php echo $name; ?> </td>
<td align="center"> <?php echo $surname; ?> </td>
<td align="center"> <?php echo $id; ?> </td>
<td width="13%" height="25" align="center" > <input height="20" width="80" name=" <?php echo "score".$i;?>" type="text" value=" <?php echo $class_score; ?>" /> </td>
<td width="5%" align="center" > <?php echo $active_score; ?> </td>
<td height="25" align="center" <?php echo $text_color_class; ?> > <?php echo $active_img; ?> </td>
</tr> <?php $i++;} ?>
</form>
button 在红色后面,每个text后都有。。
$.post('执行文件',{参数:值,参数:值},function (data){
if(data){
//想干什么就干什么
}
});data是ajax传递过去执行文件后出来的结果,你在注释处处理自己的东西就可以了
我只想把当前text的velues提交给后台存数据库。
去下载jquery包
用script src=''调用把你想要保存的text都给个id用button触发form的post或者get事件$.post('执行文件',{参数:值,参数:值},function (data){
if(data){
//想干什么就干什么
}
});
这里的post看你自己定义的,如果你的form是get的就改成getjquery获取text的值方法是
$('#id').val();执行文件上插入数据库随便你自己返回什么都可以,会赋值给data的如:
触发代码
$.post('handle.php',{text:$('#text').val()},function (data){
if(data=='succ'){
alert('成功');
}else {
alert('失败');
}
});
执行代码
$sql='';
if($result=mysql_query($sql)){
echo 'succ';
}else {
echo 'error';
}
用css来控制submit按扭的样式(也可以是图片的呀)哈哈,不知道你是不是想要这样的!!
html:<input type="submit" value="登录" name="submitland" class="input" />
css:input{
border-bottom-width:0px; border-left-width:0px; border-right-width:0px; border-top-width:0px; background: url(../images/submit.gif) no-repeat; width: 106px; height: 24px; }
<link href="editinplace.css" rel="Stylesheet" type="text/css" />
<script src="jquery-1.1.3.pack.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
setClickable();
});function setClickable() {
$('#editInPlace').click(function() {
var textarea = '<div><textarea rows="1" cols="0">'+$(this).html()+'</textarea>';
var button = '<div><input type="button" value="SAVE" class="saveButton" /> OR <input type="button" value="CANCEL" class="cancelButton" /></div></div>';
var revert = $(this).html();
$(this).after(textarea+button).remove();
$('.saveButton').click(function(){saveChanges(this, false);});
$('.cancelButton').click(function(){saveChanges(this, revert);});
})
.mouseover(function() {
$(this).addClass("editable");
})
.mouseout(function() {
$(this).removeClass("editable");
});
};function saveChanges(obj, cancel) {
if(!cancel) {
var t = $(obj).parent().siblings(0).val();
$.post("test2.php",{
content: t
},function(txt){
alert( txt);
});
}
else {
var t = cancel;
}
if(t=='') t='(click to add text)';
$(obj).parent().parent().after('<div id="editInPlace">'+t+'</div>').remove();
setClickable();
}
</script>
</head> <body>
<h1>Edit-in-Place with jQuery</h1>
<div id="editInPlace">
<p>根据 <strong>jquery</strong>写的一个小的例子。点击这里可以编辑</p>
</div>