【发布时间】:2014-11-08 01:53:09
【问题描述】:
我有一个用 PHP 扩展保存的 html 页面。它包含一个带有两个字段 home_page_text 和 aff_page_text 的输入表单。它还包含两个按钮。
<!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>
</head>
<body bgcolor="#EEE8AA">
<form name="Form1" id="Form1" action="post_message.php" method="post">
<input type="text" size="80" maxlength="400"
name="home_page_text" id="home_page_text"
value="" style="background-color:#EFD381" />
<input type="text" size="80" maxlength="400"
name="aff_page_text" id="aff_page_text"
value="" style="background-color:#EFD381" />
<input class="stand_alone_button_left_12em" type="button" value="Default The Message"
name="default_home"
onclick="return OnButton1();" />
<input class="stand_alone_button_left_12em" type="button" value="Default The Message"
name="default_aff"
onclick="return OnButton2();" />
每当按下相应的按钮时,我希望将这两个字段中的每一个设置为不同的默认值。
所以如果我按下按钮 default_home 我希望字段 home_page_text 设置为“这是主页默认值”。相应地,如果我按下按钮 default_aff 我希望字段 aff_page_text 设置为“这是 AFF PAGE 默认值”。
这些值只能是默认值。用户可以按原样接受文本,或编辑默认文本。当按下第三个按钮(type = submit)时,页面将被提交,导致 Post 调用类似“post_message.php”的页面。
我怎样才能做到这一点?
【问题讨论】: