I want the value of some vars to be shown in the string.
function test()
{
var first = document.getElementById('first').value; //value ==hello
var second = document.getElementById("second").value; //value == bye
var third = document.getElementById("third").value; //value == crazy
var forth = document.getElementById("forth").value; // value == night
var myString = " \
<script> \
var firstValue = "\" + first + \""; \
var secondValue = "\" + second + \""; \
var thirdValue = "\" +third + \""; \
var forthValue = "\" +forth + \""; \
<\/script> ";
I want the string to display:
<script>
var firstValue = " hello ";
var secondValue = " bye ";
var thirdValue = " crazy ";
var forthValue = " night ";
</script> ";