954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Javascript variables in text statement

Sorry another silly issue with javascript but I am getting there.

Can someone please explain how I should write this thankd.
I tried stoping and restarting the string 'hello' +var 'more text';
maybe I am just too tired.

The variables are already defined.

document.getElementById('welcomeone').innerHTML='+firstnameval you have successfully created your account, a confirmation email has been sent to +emailval etc blah blah.'
shadiadiph
Junior Poster
119 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<script language="javascript">
function test()
{
	var firstnameval="Raja";
	var emailval="onsitetutor@yahoo.com";
	document.getElementById('welcomeone').innerHTML= firstnameval + " you have successfully created your account, a confirmation email has been sent to " + emailval +  " blah blah."
}
</script>

<body onLoad="test()">
<input type="text" name="firstnameval" value="Raja"/>
<div id='welcomeone'></div>
</form>
</body>
</html>
rajarajan07
Nearly a Posting Virtuoso
1,447 posts since May 2008
Reputation Points: 167
Solved Threads: 239
 

thanks rajarajan07

shadiadiph
Junior Poster
119 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You