按钮将$ body数据动态加载到<textarea> </textarea>

时间:2011-03-06 15:14:44

标签: php javascript

    <form id="form1" name="form1" method="post">
    <textarea name="list" id="emails" rows="10" value="Send to" ondblclick="select_all('emails');" onfocus="if (this.value == 'Send to' || this.value == 'Send to: separate emails by comma and space') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Send to: separate emails by comma and space';}" cols="40">Send to</textarea><br/>
    <input name="subject" id="subject" value="Subject" onfocus="if (this.value == 'Subject') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Your JaGex Account';}" size="17"/>
    <select name="template" id="template" onchange="load();">
        <option value="none">Don't use template</option>
        <option value="RWT">Report Abuse</option>
        <option value="renew">Resend Email Codes</option>
    </select>
    <button name="load" type="submit" id="bt3" onclick="load();" style="width: 50px;"><span>Load</span></button><br/>
    <textarea name="body" rows="10" id="content" ondblclick="select_all('content');" cols="40"><?php echo htmlspecialchars($body)?></textarea><br/>
    <button name="submit" type="submit" id="bt1" onclick="disable();" style="width: 345px;"><span>Send</span></button>
    <button name="submit" type="submit" id="bt2" style="visibility:hidden;width: 345px;"><span>Sending...</span>
    </button>
</form>


<script type="text/javascript">
function load() { 
    document.form1.submit(); 
}
</script>

当我点击加载时,它不会将任何选项数据加载到textarea中。

else if ($template == "RWT") {
        $body = "Dear Player,<br/><br/>";
        $body .= "We regret to inform you that your account has received an infraction due to a Major offense. Please visit the appeal section under Account Management to view evidence of your infraction(s) and to appeal any infraction(s) that you feel were unjustified.<br/><br/>";

如何将数据发布到textarea内?

1 个答案:

答案 0 :(得分:0)

php

 // have you written this like before else
        $template=$_POST['template'];

    else if ($template == "RWT") {

<强>的javascript

 function load()
   {
    document.forms["Your_form"].submit();
   }