A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Calling CSS in Javascript

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    20

    Calling CSS in Javascript

    in HTML you can call CSS

    Code:
    <head>
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    
    <tr><td class="cssHere">Display</td></tr>
    can you even call CSS in javascript?
    Code:
    document.writeln("<tr><td class="cssHere">" + Display + "</td></tr>");
    if so how do you even call the "style.css"

    thanks

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    The same way. If Javascript is just writing part of the page:

    Code:
    <head>
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    
    <script>
    document.writeln("<tr><td class='cssHere'>" + Display + "</td></tr>");
    </script>
    If it's writing the whole page, you need to write the <head>
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head> with Javascript as well.

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

HTML5 Development Center