CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006
    Posts
    157

    inser variable into the tag

    Hi all,
    I am new in Javascript world so this question might be for some very simple but still I could not find a solution for it by seraching the web.
    I have a variable:
    var myvar="mystring";
    that I want to print together with a html tag:
    ("<span class=\"myclass\">"document.write(myvar)"</span>")
    Could someone help me?
    Thanks

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: inser variable into the tag

    Code:
    document.write('<span class="myclass">' + myvar + '</span>');
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured