function toggleMessage(MessId, Action)
{
var MessTxt = "";
var m8 = "Delivery of floor pack to included: " + document.getElementById('cbDelPoscod');
switch(MessId) {
case "m8":
MessTxt = m8;
break;
}
if (Action == ('a')) {
document.getElementById("ResultsTableTxt").insertRow(-1).innerHTML = '<tr id=' + MessId + '><td>' + MessTxt + '</td></tr>';
}
else {
document.getElementById("ResultsTableTxt").deleteRow(MessId);
}
}
function toggleMessage(MessId, Action)
{
var MessTxt = "";
var m1 = "All Metsa Wood Joist material including perimeter noggins for deck support, 6m non-load bearing partition noggins";
var m2 = "All Metsa Wood Joist material including rim board, 6m non-load bearing partition noggins included";
var m3 = "Finnseal end caps for masonry construction, restrain straps for lateral wall support";
var m4 = "Rimboard and noggins for &TEXT(SUM(Calculation!H12:H15),0)& party wall(s) included";
var m5 = "Stair trimmers and hangers to support all floor joists included";
var m6 = "No delivery included. Delivery cost added to final floor price";
var m7 = "All Metsa Wood Joist material including rim board, 6m non-load bearing partition noggins included";
var m8 = "Delivery of floor pack to included: " + document.getElementById('tbFloorWidthA');
var m9 = "Restrain straps for lateral wall support in a 2.5 to 3 storey house";
var m10 = "This price is indicative and for domestic floors, only. For commercial floors, please get in touch with Metsa Wood";
var m11 = "Delivery within 3 weeks from date of order. Off-loading from transport vehicle is the customer's responsibility";
var m12 = "Final floor price can vary when floor is fully designed. For full floor design please forward this printout with full";
var m13 = "set of drawings in PDF, DWG or IFC format to uk@metsagroup.com with subject 'Finnframe";
var m14 = "Price valid until &DAY(TODAY()+90)&/&MONTH(TODAY()+90)&/&YEAR(TODAY()+90)&, which is 90 calendar days from today.P41 Price valid until &DAY(TODAY()+90)&/&MONTH(TODAY()+90)&/&YEAR(TODAY()+90)&, which is 90 calendar days from today.P41 Price valid until &DAY(TODAY()+90)&/&MONTH(TODAY()+90)&/&YEAR(TODAY()+90), which is 90 calendar days from today";
switch(MessId) {
case "m1":
MessTxt = m1;
break;
case "m2":
MessTxt = m2;
break;
case "m3":
MessTxt = m3;
break;
case "m4":
MessTxt = m4;
break;
case "m5":
MessTxt = m5;
break;
case "m6":
MessTxt = m6;
break;
case "m7":
MessTxt = m7;
break;
case "m8":
MessTxt = m8;
break;
case "m9":
MessTxt = m9;
break;
case "m10":
MessTxt = 10;
break;
case "m11":
MessTxt = m11;
break;
case "m12":
MessTxt = m12;
break;
case "m13":
MessTxt = m13;
break;
case "m14":
MessTxt = m14;
break;
}
if (Action == ('a')) {
document.getElementById("ResultsTableTxt").insertRow(-1).innerHTML = '<tr id=' + MessId + '><td>' + MessTxt + '</td></tr>';
}
else {
document.getElementById("ResultsTableTxt").deleteRow(MessId);
}
}
document.getElementById('cbDelPoscod ').value;
var index = document.getElementById('cbDelPoscod').selectedIndex;
var text = document.getElementById('cbDelPoscod').options[index].text;
I'll have a think about the other bit of your question and comment shortly.
var text = document.getElementById('cbDelPoscod').options[document.getElementById('cbDelPoscod').selectedIndex].text;
You might want to start thinking about using jQuery if your app is going to do more javascript processing - it will make your life a whole lot easier. For example, to do the same as above, you'd just have this:$("#cbDelPoscod option:selected").text();
I was thinking something along the same lines as your idea for the list. If it's just for display, then it's probably the easiest solution.
document.getElementById("ResultsTableTxt").rowID().style.display = 'none';
<table id="ResultsTableTxt">
<tr data-ref="m1"><td>Row 1</td></tr>
<tr data-ref="m2"><td>Row 2</td></tr>
<tr data-ref="m3"><td>Row 3</td></tr>
<tr data-ref="m4"><td>Row 4</td></tr>
<tr data-ref="m5"><td>Row 5</td></tr>
</table>
Then you can just filter the row by the MessId an add a class to the row that shows it (assuming all your table rows are hidden by default)$('#ResultsTableTxt tr').filter( function() { return $(this).data('ref') == MessId } ).addClass('show');
Your CSS might look something like this:#ResultsTableTxt tr { display:none; }
#ResultsTableTxt tr.show ( display: table-row; )
You can see a mini-demo here -> https://jsfiddle.net/Chris
Open in new window