我正在創建一個網站,用戶在該網站上輸入數據,然後將其提交給數據庫,同時用戶收到郵件。基於HTML/CSS/JS中先前輸入字段的新輸入
<body>
<form method="post" action="">
<input id="input-3" name="change" type="text" placeholder="CHG000010333653" required autofocus style="text-transform:uppercase" pattern=^CHG[0-9]{12,12}$ title="The format should be in CHG000010333653 "/>
<label for="input-3">
<span class="label-text">Change Number</span>
<span class="nav-dot"></span>
<div class="signup-button-trigger">Begin</div>
</label>
<input id="input-4" name="waiver" type="checkbox" placeholder="Yes/No/NA" required pattern=([YESNOyesnoAa]){2,3} title="Input Should be Yes or No "/>
<label for="input-4">
<span class="label-text">Waiver ID Entered</span>
<span class="nav-dot"></span>
</label>
<input id="input-5" name="inc" type="text" placeholder="Yes/No" required pattern=([YESNOyesno]){2,3} title="Input Should be Yes or No " />
<label for="input-5">
<span class="label-text">INC/RITM Related</span>
<span class="nav-dot"></span>
</label>
<input id="input-6" name="environment" type="text" placeholder="Production/QA/Development" required pattern=([A-z]){2,11} title="Input Should be Production, QA or Development "/>
<label for="input-6">
<span class="label-text">Server Environment</span>
<span class="nav-dot"></span>
</label>
<input id="input-7" name="support" type="text" placeholder="Windows/Virtualisation/Storage" required pattern=([A-z]{4,11}+[lL0-9]{2,2}) title="Input Should as Windows L1 "/>
<label for="input-7">
<span class="label-text">Server Support Group</span>
<span class="nav-dot"></span>
</label>
<input id="input-8" name="attach" type="text" placeholder="Yes/No" required pattern=([YESNOyesno]){2,3} title="Input Should be Yes or No "/>
<label for="input-8">
<span class="label-text">Attachments Attached (Pre Implementation/Waiver/Required Mails)</span>
<span class="nav-dot"></span>
</label>
<input id="input-9" name="schedule" type="text" placeholder="Yes/No" required pattern=([YESNOyesno]){2,3} title="Input Should be Yes or No "/>
<label for="input-9">
<span class="label-text">Schedule is correct</span>
<span class="nav-dot"></span>
</label>
<input id="input-10" name="type" type="text" placeholder="Yes/No" required pattern=([YESNOyesno]){2,3} title="Input Should be Yes or No "/>
<label for="input-10">
<span class="label-text">Change Type Correct</span>
<span class="nav-dot"></span>
</label>
<input id="input-11" name="affect" type="text" placeholder="Yes/No" required pattern=([YESNOyesno]){2,3} title="Input Should be Yes or No "/>
<label for="input-11">
<span class="label-text">Affected CI's Entered</span>
<span class="nav-dot"></span>
</label>
<input id="input-12" name="risk" type="text" placeholder="Yes/No" required pattern=([YESNOyesno]){2,3} title="Input Should be Yes or No "/>
<label for="input-12">
<span class="label-text">Risk Assesment Correct</span>
<span class="nav-dot"></span>
</label>
<input id="input-13" name="ref" type="text" placeholder="Yes/No" required pattern=([YESNOyesno]){2,3} title="Input Should be Yes or No "/>
<label for="input-13">
<span class="label-text">Reference Change Correct</span>
<span class="nav-dot"></span>
</label>
<input id="input-14" name="priority" type="text" placeholder="Yes/No" required pattern=([YESNOyesno]){2,3} title="Input Should be Yes or No "/>
<label for="input-14">
<span class="label-text">Change Priority Correct</span>
<span class="nav-dot"></span>
</label>
<button type="submit">Submit Details</button>
<p class="tip">Press Tab</p>
<div class="signup-button">Begin</div>
</form>
<script>
所以我想添加什麼額外的輸入(徵求意見文本輸入),如果任何輸入的不是「是」其他的輸入4,輸入5,和輸入7輸入-14 。我正在使用用於UI的CSS(這是爲什麼我由於設計而將其更改爲複選框/下拉菜單的原因),並且使用IIS部署了該網站。
那麼無論如何要做到這一點?提交按鈕將數據提交給MS Access文件。
從我搜索它可以通過JS完成(可能),但我沒有太多的經驗,所以任何指導/幫助將不勝感激。
編輯1:代碼https://codepen.io/shwetanshu/pen/XgBLwW 我的目標是,如果前4個輸入字段中有任何「是」,那麼第五個應該是註釋。否則不是。使用document.createElement("INPUT")
創建後
var node = document.createElement("INPUT"); // Create a texte input node
var textnode = document.createTextNode("Water"); // Create a text node
node.appendChild(textnode); //Append the text to <li>
document.getElementById("myList").appendChild(node); // Append the text input to <ul> with id="myList"
在這裏你添加一個JavaScript對象到您的文檔:
好了,你有問題,是一個非常好的介紹給JS,如果你想了解它。你可以開始學習jQuery基礎恕我直言。 – Keloo
我知道我無法避免JS。所以這是一個很好的起點。我會仔細看看的。 – Anti21