942,782 Members | Top Members by Rank

Ad:
Jun 30th, 2010
0

Javascript variables in text statement

Expand Post »
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.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. document.getElementById('welcomeone').innerHTML='+firstnameval you have successfully created your account, a confirmation email has been sent to +emailval etc blah blah.'
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
shadiadiph is offline Offline
117 posts
since Apr 2008
Jun 30th, 2010
0
Re: Javascript variables in text statement
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title> New Document </title>
  5. <meta name="Generator" content="EditPlus">
  6. <meta name="Author" content="">
  7. <meta name="Keywords" content="">
  8. <meta name="Description" content="">
  9. </head>
  10. <script language="javascript">
  11. function test()
  12. {
  13. var firstnameval="Raja";
  14. var emailval="onsitetutor@yahoo.com";
  15. document.getElementById('welcomeone').innerHTML= firstnameval + " you have successfully created your account, a confirmation email has been sent to " + emailval + " blah blah."
  16. }
  17. </script>
  18.  
  19. <body onLoad="test()">
  20. <input type="text" name="firstnameval" value="Raja"/>
  21. <div id='welcomeone'></div>
  22. </form>
  23. </body>
  24. </html>
Reputation Points: 167
Solved Threads: 239
Nearly a Posting Virtuoso
rajarajan07 is offline Offline
1,445 posts
since May 2008
Jul 2nd, 2010
0
Re: Javascript variables in text statement
thanks rajarajan07
Reputation Points: 10
Solved Threads: 0
Junior Poster
shadiadiph is offline Offline
117 posts
since Apr 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: How to get AddRowValues jQuery
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: changing the opacity style using javascript





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC