PHP代码如下:<input name="textfield" type="text" value="123456789">不要使用等直接取得value上的字符串123456789 赋给一个在PHP中的变量谢谢高手帮忙

解决方案 »

  1.   

    这其实是JS的问题。要得到更标准的答案应该去JS大阪问,下面的试试,看行不行。
    <script>
    window.onload=function(){
       var aa=getElementByName('textfield').value;
       window.lacation.href='aa.php?key='+aa;
    }</script>
    <input name="textfield" type="text" value="123456789">然后在aa.phpz中:
    $a=$_GET['key'];
      

  2.   

    取不到呀<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <script>
    window.onload=function(){
      var aa=getElementByName('textfield').value;
      window.lacation.href='aa.php?key='+aa;
    }
    </script><input name="textfield" type="text" value="123456789">
    <?php
    $a=$_GET['key'];echo "输出字符:".$a;
    ?>
    <body>
    </body>
    </html>
      

  3.   


    本来是想把 下面的selectid变量,赋给PHP然后$_SESSION到另一个PHP 页面使用的
    function newtree(){var selectedNode = zTreeObj.getSelectedNode();
    if (selectedNode)
    {
    var selectid=selectedNode.Id
    //document.write(selectid);
    //alert("----名称:---------"+selectedNode.Name+"---Id:-----"+selectedNode.Id+"----Pid:-------"+selectedNode.PId+"结束");
    }
    else
    {
    alert("请选择要生成新建文件夹位置!");
    }}周转了很久,把它赋给了隐藏的input-value,但是现在input也周转不到PHP上去,真烦
      

  4.   

    诶!!!你2L的代码是可以的,只不过你写的错误太多了。
    把下面代码存成aa.php.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <script>
    //window.onload=function(){
    //   var aa= document.getElementsByName('textfield')[0].value;
    //   
    //   var bb= document.getElementById('textfield').value;
    //   window.location.href = "aa.php?key="+aa;
    //} function _submit()
     {
        var aa= document.getElementsByName('textfield')[0].value;
       
        var bb= document.getElementById('textfield').value;
        下面2个都可以。
        //window.location.href = "aa.php?key="+aa;
        window.location.href = "aa.php?key="+bb;
     }
    </script><input id="textfield" name="textfield" type="text" value="123456789">
    <input name="button" type="button" value="提交" onclick="_submit()" >
    <?php
    $a=$_GET['key'];echo "输出字符:".$a;
    ?>
    <body>
    </body>
    </html>
      

  5.   

    找到解决方案了,变量定义页面,<SCRIPT LANGUAGE="JavaScript">
     function _submit() 
     { 
       newtree();
       xmlhttp = new XMLHttpRequest();
       var bb= document.getElementById('33').value;
        
    xmlhttp.onreadystatechange = function() {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                        document.getElementById("test").innerHTML = xmlhttp.responseText;
                    }}
        xmlhttp.open("GET",  "45454.php?key="+bb, true);
    //alert xmlhttp.readyState==4;
        xmlhttp.send();
     if(bb!=="")
     {
      showPopWin('新建文件夹','directory.php',300,280,null,true,true);
    }
     }
    </SCRIPT>SESSION页面(45454.php)
    <?php
    session_start();
    $a=$_GET["key"];
    $_SESSION['name']=$a;
    echo $a;
    ?>传递到另一个页面,显示出来
    session_start();
    $ssion=$_SESSION['name'];
    unset($_SESSION['name']);
    echo $ssion;谢谢各位参与解决