我知道我可能以最不優雅的方式做到這一點,但我仍然是初學者。我想要生成一個用戶表單,用戶可以在其中輸入變量。點擊按鈕時,這些變量出現在段落中的適當位置(Ex .. name,Date)。我將代碼中的一些代碼從一個框複製到另一個框......現在我想創建一個段落,其中變量位於相關句子的中間。HTML和Javascript;我想在段落中重複我的表單結果
<!DOCTYPE html>
<html lang = "en-US">
<head>
<meta charset = "UTF-8">
<title>textBoxes.html</title>
<script type = "text/javascript">
function sayHi(){
// THIS is WHERE input VARIABLES are set, followed by the OUTPUT
//this defines the First Week of Sickness Paid Start Date
var BPCName = document.getElementById("BPCName");
var OUTBPC = document.getElementById("OUTBPC");
var name = BPCName.value;
OUTBPC.value = " " +name+ ""
//This defines the last week of Sickness Benefits Paid
var LWPName = document.getElementById("LWPName");
var OUTLWP = document.getElementById("OUTLWP");
var name = LWPName.value;
OUTLWP.value = " " +name+ ""
//This defines Total Weeks of Sickness Benefits Paid
var TWSPName = document.getElementById("TWSPName");
var OUTTWSP = document.getElementById("OUTTWSP");
var name = TWSPName.value;
OUTTWSP.value = " " +name+ ""
// This Defines the Date the Medical Was received
var MEDRName = document.getElementById("MEDRName");
var OUTMEDR = document.getElementById("OUTMEDR");
var name = MEDRName.value;
OUTMEDR.value = " " +name+ ""
//This Defines the Medical Provider
var MEDPName = document.getElementById("MEDPName");
var OUTMEDP = document.getElementById("OUTMEDP");
var name = MEDPName.value;
OUTMEDP.value = " " +name+ ""
// THis Defines the Date of Incapacity indicated on the Medical
var INCName = document.getElementById("INCName");
var OUTINC = document.getElementById("OUTINC");
var name = INCName.value;
OUTINC.value = " " +name+ ""
} // end sayHi
</script>
<link rel = "stylesheet"
type = "text/css"
href = "textBoxes.css" />
</head>
<body>
<h1>Automatic</h1>
<form action = "">
<fieldset>
<label>Start Date: </label>
<input type = "text"
id = "BPCName" />
<input type = "button"
value = "click me"
onclick = "sayHi()"/>
<input type = "text"
id = "OUTBPC" />
</fieldset>
</form>
<form action = "">
<fieldset>
<label>Last Week of Benefits Paid: </label>
<input type = "text"
id = "LWPName" />
<input type = "button"
value = "click me"
onclick = "sayHi()"/>
<input type = "text"
id = "OUTLWP" />
</fieldset>
<form action = "">
<fieldset>
<label>Total Weeks of Sickness Benefits Paid: </label>
<input type = "text"
id = "TWSPName" />
<input type = "button"
value = "click me"
onclick = "sayHi()"/>
<input type = "text"
id = "OUTTWSP" />
<form action = "">
<fieldset>
<label>Date Medical Received: </label>
<input type = "text"
id = "MEDRName" />
<input type = "button"
value = "click me"
onclick = "sayHi()"/>
<input type = "text"
id = "OUTMEDR" />
<form action = "">
<fieldset>
<label>Name of Practitioner: </label>
<input type = "text"
id = "MEDPName" />
<input type = "button"
value = "click me"
onclick = "sayHi()"/>
<input type = "text"
id = "OUTMEDP" />
<form action = "">
<fieldset>
<label>Date of Incapacity Indicated on Medical: </label>
<input type = "text"
id = "INCName" />
<input type = "button"
value = "click me"
onclick = "sayHi()"/>
<input type = "text"
id = "OUTINC" />
<form action = "">
</fieldset>
</form>
<h2> Example Document</h2>
<p>The client was sent an EForm form requesting submission of original medical to confirm eligibility for benefits.
The client was paid XXXXX weeks of benefits during the period XXXX to XXXXX
The client submitted an original doctor’s note signed by XXXX dated XXX
Claimant notified in writing that claim is on order.
The medical addresses all weeks in which sickness benefits were paid.
</P>
</html>
使用示例進行說明plz – chaitanya90 2014-11-06 17:56:52
您是否正在尋找代碼的最後一位用戶輸入替換段落? – chaitanya90 2014-11-06 17:59:42
這是正確的。我希望輸入顯示在代碼末尾的段落 – Ojay 2014-11-06 18:14:28