试图通过这个脚本弄清楚下一步该做什么

时间:2016-11-17 08:51:11

标签: javascript jquery html

我以前从未编程,但过去一周我一直在慢慢学习。我已经创建了一个表单,它基本上允许我的部落成员填写一些信息,然后在提交时它创建自己的自己的线程并为我命名。它完美无缺。代码位于下方。

<form id='generic_form'>
<div class='category'>

<table class='cat_head'>
<tr>
<td><h2 style='text-align:center'>Recruiting Form</h2></td>
</tr>
</table>
</div>

<table>
<tr>
<td> </td>
</tr>
</table>

<table id='form_spec'>
<tr>
<th colspan='2'><h2>Please fill out the fields below:</h2></th>
</tr>

<tr>
<td style="color: yellow;">Recruits Name:</td>
<td><input type='text' /></td>
</tr>

<tr>
<td style="color: yellow;">Does The Teamspeak Name & In Game Name Match?:</td>
<td>
<select>
<option>No</option>
<option>Yes</option>
</select>
</td>
</tr>

<tr>
<td style="color: yellow;">Where Did They Come From?:</td>
<td>
<select>
<option>Warframe Recruitment Chat</option>
<option>Facebook Group</option>
<option>Friend of a Current Member</option>
<option>Warframe Forums</option>
<option>Returning Member</option>
<option>Teamspeak -Clan Transfer</option>
<option>Stream Recruitment</option>
</td>
</tr>

<tr>
<td style="color: yellow;">Additional comments(things we should be aware of ex, no mic, under 15yrs, attitude etc):</td>
<td><textarea rows='3'></textarea></td>
</tr>

<tr>
<td colspan='2' id='send_form'><button type='submit'>Submit</button></td>
</tr>

</table>

</form>

<style type='text/css'>
/* <![CDATA[ */
#form_spec tr td:first-child {
font-weight: bold;
width: 30%;
}
#form_spec input, #form_spec textarea {
width: 500px;
}
/* ]]> */
</style>

<script type='text/javascript'>
var form_script = {
    form_id: $('#generic_form'),
    status_id: $('#send_form'),
    specific_id: $('#form_spec'),
    enable_guests: false,
    pm: {
    enabled: false, // Does not work for guests
    user: "ImMrBloo", // 1 user only
    title: "New Form From {{user_name}}",
    content: "{{form}}"
},
    topic: {
    enabled: true,
    forum_id: 5027801, // 1 id only
    title: "{{user_name}} Recruited Someone",
    description: "",
    content: "{{form}}"
},
    statuses: {
    not_logged_in: "You must be registered and signed in to use this feature.", // Used if enable_guests: false
    first: "Coagulating data...",
    second: "Sending form...",
    done: "Form sent!"
},
    submission_formatting: {
    separator: ' ',

    before_all: '',
    after_all: '',

    before_question: '[b][color=yellow]',
    after_question: '[/b][/color]',

    before_response: '[i]',
    after_response: '[/i]'
},
    possible_elements: 'input, textarea, select' // For the second column of table; .val() must work on it
};
</script>

<script type='text/javascript' src='http://z3.ifrm.com/313/104/0/p366373/form_script.js'></script>






<script type="text/javascript">
(function ($) {
var rURL = 'http://s15.zetaboards.com/Panzerfaust/forum/5027801/';

form_script.form_id.submit(function () {
form_script.form_id.after('<div style="text-align: center; margin-top: 10px; font-style: italic; font-weight: 700">Redirecting you in 5 seconds...</div>');
window.setTimeout(function () {
location.href = rURL;
}, 5000);
});
})(jQuery);
</script>
</div></div><div id="foot_wrap"><table cellspacing="0" id="foot">
<tr>
<td id="foot_themechooser"><form action="http://s15.zetaboards.com/Panzerfaust/index/" method="post"><input type="hidden" name="r" value="pages/recruitingform%2F" /><input type="hidden" name="r2" value="78be5b909814b66d9d88ca275b1a9703" /><label for="setskin">Choose a theme:</label> <select name='setskin' id='setskin' >
<option value='1207524' selected="selected">1: PSO (No width limit)</option>
<option value='1207535'>Mobile</option>
<option value='1215962'>Shapes Red</option>
</select>

 <button type="submit" id="btn_setskin">Change</button></form></td>
<td id="foot_links">

</td>
<td id="foot_datetime">
<a href='http://s15.zetaboards.com/Panzerfaust/home/?c=4' title='Change Time Settings'><img src='http://z5.ifrm.com/30160/63/0/p1167159/clock.png' alt='Time:' /> 10:59 PM Nov 13</a>
</td>
</tr>`

此代码确实按预期工作。我想补充的是下面代码中表单第一个问题的答案

<tr>
<td style="color: yellow;">Recruits Name:</td>
<td><input type='text' /></td>
</tr>

并将答案显示在说明:“”,下面一行。 因此,当创建一个线程时,它会说出用户名和描述中的新兵名称。根据我的理解,我需要做的就是回应第一个答案,但我不知道如何。如果您有任何知识或知道如何正确实现这一点。我欠你的债。谢谢。

 topic: {
enabled: true,
forum_id: 5027801, // 1 id only
title: "{{user_name}} Recruited Someone",
description: "",
content: "{{form}}"

0 个答案:

没有答案