假设student_input.php的子框架的名称为inputFrame,里面的发送信息的form名称为form1,显示学生姓名的button名称为student_name,用来储存学生id的隐藏控键的名称为student_id下面是student_view.php,在取出学生名字的时候,带上他们的id:
<?
//取出所有学生的id,姓名,并如下方式循环输出
echo "<a href=# onclick=\"return changeButtonName('$student_id',this.innerText)\">$student_name</a><BR>";
?>
<script>
function changeButtonName(id,name){
  inputFrame.document.form1.student_name.value=name;
  inputFrame.document.form1.student_id.value=id; 
  return false;
}
</script>

解决方案 »

  1.   

    to 早起的鸟儿:
       
        你真的起来的很早哦
        7.30估计就起来了
        首先谢谢你帮我看这个问题
    我明白你的意思
    但是在student_view.php中
    我是通过读一个text文件来显示发言的
    所以没有student_id,student_name这个东西
    我知道如果是数据库的话
    就会有的
    但是如果要换成数据库的话
    要改很多东西
    我不想改哦
    怎么办?
    怎么办?谢谢您!
      

  2.   

    首先你要用一个标志来找到某个学生吧。通常用id或者账号。这里就当你用姓名来找到这个学生的吧。这样更容易
    <?
    //从文件中取出所有学生的姓名$student_name,用如下方式循环输出成学生列表
    echo "<a href=# onclick=\"inputFrame.document.form1.student_name.value='$student_name';return false;\">$student_name</a><BR>";
    ?>
      

  3.   

    to 鸟儿兄:
        实在是没有办法了
        还是没有解决
        
    为了能用第一种方法
    我把数据库都变了<?php$query="create table teachermsg(tid smallint,tto varchar(30),tname varchar(30),message varchar(255),color enum('red','white','green','yellow','blue','black'),in_time time,tmid int unsigned not null auto_increment primary key)";
    mysql_query($query) or die("error1");?>