HTA assign variable to textarea with Line Breaks

Xlacs

Board Regular
Joined
Mar 31, 2021
Messages
105
Office Version
  1. 2016
Platform
  1. Windows
Hi Everyone,

I have this simple problem, basically, I wanted a linebreak once i assign a value in my textarea but nothings seems working.
Below is my code that changes that value of textarea based on the dropdown selected.

tr><td>Template:</td><td>
<select name="template" onChange = "setTemplate(this);">
<option value="0">Admission</option>
<option value="1">Registration</option>
<option value="2">Speech on 2,3 May</option>
</select>
</td>
<tr>
<td>Message: </td>
<td>
<textarea name="adminmessage" id="adminmessage" rows="5" cols="50"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" id="submit" value="Send SMS" class="button-primary" /></td>
</tr>
</table>
</form>
<script>
test0 = "";
test1 = "test string 1 \n this is new LIne \n 3rd Line";
test2 = "test string 2 \n this is new LIne \n 3rd Line";
function setTemplate(t) {
var otionValue = t.value;
if (otionValue == "0") {
document.getElementById('adminmessage').innerHTML = test0;
} else if (otionValue == "1")
document.getElementById('adminmessage').innerHTML = test1;
else if (otionValue == "2")
document.getElementById('adminmessage').innerHTML = test2;
};
</script>
</div>
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top