First of all, thank you for trying to help me. It should be simple (I think I am only missing something)
I have a htm file that it’s used to produce a pdf file and gets date from a screen selection
It is about string manipulation (extraction a substring that starts with “[“ from a string and displaying the result )
Example instead of Van5[15] it’s supposed to display Van
(Note: data for [RoomName], [ClassName]are variables that comes from a previous screen)
The code is correct and verified on jsfiddle.net . The problem is, this HTM file that it is used to create the PDF output file displays on top the content between script tags;
function extract()
{
var str = "Van5 [14]";
return str.substring(0, str.lastIndexOf("["));
}
document.getElementById("demo").innerHTML = extract();
My question is, how to display the result(Van5) of this function on PDF file, not the content between tags
What I have tried:
<html>
<body>
<table>
<tr>
<td colspan="2" style="text-align:center; font-size:80; font-family:Verdana; font-weight:bold;border:1px solid Black;">
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center; font-size:60; font-family:Verdana; font-weight:bold;border:1px solid Black;">
[RoomName]
<p id="demo"></p>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center; font-size:29;font-family:Verdana;font-weight:bold;border:1px solid Black;">
[ClassName]
</td>
</tr>
</table>
<script>
function extract() {
var str = "Van5 [14]";
return str.substring(0, str.lastIndexOf("["));
}
document.getElementById("demo").innerHTML = extract();
</script>
</body>
</html>