PDA

View Full Version : Adding contents of a textbox into a string in code output



schmoose
04-06-2008, 02:47 PM
Hi all, I am using some code as below to write to a textarea box on my page



function AddnotificationComm1 (formObj)
{
document.getElementById("showCode2").value="Line has failed, Jenbo have been informed and will attend on"
}


I have a text box on the page and I need to put its entry into the output within the code above!

The textbox is called "Comm1Lineno" so my code would look something like this but with the correct syntax -



function AddnotificationComm1 (formObj)
{
document.getElementById("showCode2").value="Line "Comm1Lineno" has failed, Jenbo have been informed and will attend on"
}


"Comm1LineNo" is a text box in the notifications form.

I am used to Vb and have tried a few things here but cant get it in.

I appreciate your help with this - Many Thanks

Rob

Nile
04-07-2008, 01:19 AM
Try this:


function AddnotificationComm1 ()
{
document.getElementById("showCode2").value='Line "Comm1Lineno" has failed, Jenbo have been informed and will attend on';
}

I deleted your variable in the function.
I changed your double quotes to single quotes on the values.
I put a `;` at the end of the line