<input name="title" type="text" id="title" value="这里是我要保存的内容!" onblur="location.href='save.php'"/>   就是鼠标移开后就保存内容,但是参数不知道怎么来处理,请高手指教。

解决方案 »

  1.   

    <input name="title" type="text" id="title" value="这里是我要保存的内容!" onblur="pass(this)"/><script>
    function pass(obj) {

    window.location.href = "save.php?value=" + obj.value;
    }
    </script>save.php<?php
    if(isset($_GET['value']))
    echo $_GET['value'];
    ?>
      

  2.   

    window.location.href = "save.php?value=" + obj.value;   
    这个的话 当前页面会执行save.php,达不到LZ要的效果,
     实现这个要用ajax的,
    onblur的时候异步请求save.php-->save.php输出要保存的内容-->前台获取内容,并赋值给title对话框~
      

  3.   

    <input name="title" type="text" id="title" value="这里是我要保存的内容!" onblur="postValue()"/><script>
    //function pass(obj) {
    //
    // window.location.href = "save.php?value=" + obj.value;
    //}
    var xmlHttp;
    function GetXmlHttpObject(){

    var xmlHttp=null;
    try {

     // Firefox, Opera 8.0+, Safari
     xmlHttp=new XMLHttpRequest();
     } catch (e) {
     
     //Internet Explorer
    try {

    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {

    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
     }
    return xmlHttp;
    }function postValue(){

    xmlHttp=GetXmlHttpObject();
    if(xmlHttp==null) {

    alert ("Browser does not support HTTP Request");
    return;
    }
    var objInput=document.getElementById("title");
    var url="save.php?";
    var postdate="value="+objInput.value;
    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
    xmlHttp.send(postdate);
    }function stateChanged() { 

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="200"){\

    var str_text=xmlHttp.responseText;
    alert(str_text);
    document.getElementById("title").value=str_text;

    }
    </script>
    save.php
    <?php
    echo  $_POST["value"];
    ?>
      

  4.   

    6楼 .正解.用ajax 加了失去焦点事件.
      

  5.   


    这里不小心加了个反斜杠借鉴的时候请删掉:function stateChanged() { 
        
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="200"){\
      

  6.   

    1 奇了怪了,现在ajax 都流行硬写么?