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> </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>
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> </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>