How to dispaly HTML page in Silverlight application?

Problems with html coding?

  • thanks for the help guys but still can't get it to work. I have a login page that sets the variable UserIsMember with the code '<script language="JavaScript"> <!-- var UserIsMember = "True" --> </script> On my index page i have the following code: <!-- Menu START --> <script language="JavaScript"> <!-- var Membership=(UserIsMember); if (Membership=="IsMember") { document.write('<link rel="stylesheet" type="text/css" href="/Scripts/member.css">/Members Menu />'); } else { document.write('<link rel="stylesheet" type="text/css" href="/Scripts/notmember.css">Non Members Menu />'); } --> </script> <!-- Menu END --> Here is the member.css file code: @charset "utf-8"; /* CSS Document */ h1.notMember{ display:none } h1.isMember{ display:block Menu <hr> <a href="/index.html" class="style3">Home Page</a> <a href="/awards.html" class="style3">Awards</a> <a href="/bank.html" class="style3">Bank</a> <a href="/calendar.html" class="style3">Calendar</a> <a href="/characters.html" class="style3">Characters</a> <a href="/events.html" class="style3">Events</a> <a href="/feedback.html" class="style3">Feedback.</a> <a href="/gallery.html" class="style3">Gallery</a> <a href="/groups.html" class="style3">Groups</a> <a href="/polls.html" class="style3">Polls</a> <a href="/raids.html" class="style3">Raids</a> <a href="/ranks.html" class="style3">Ranks</a> <a href="/shouts.html" class="style3">Shouts</a> } and here is the notmember.css file code @charset "utf-8"; /* CSS Document */ h1.notMember{ display:block Menu <hr> <a href="/index.html" class="style3">Home Page</a> <a href="/who-we-r.html" class="style3">Who we are and what we are about.</a> <a href="/history.html" class="style3">History of our Kinship.</a> <a href="/philosophy.html" class="style3">Philosophy of our Kinship.</a> <a href="/public_html/rules.html" class="style3">Rules of our Kinship.</a> <a href="/application.html" class="style3">Application to join to theKinship.</a> <a href="/feedback.html" class="style3">Feedback or Comments.</a> } h1.isMember{ display:none } The problem is that neither of the two menus are being displayed. Any further help would be gratefully received Michael }

  • Answer:

    Basically: You can't use CSS to write HTML. CSS stands for Cascading Style Sheets, and can only define the styles to be applied to elements on your HTML page, not the content within them or the attributes themselves. You will either need to write the entire block out through the JavaScript, or preferably use a scripting language like PHP to check if someone is a member and generate the page as this will be done on the server (JavaScript won't work if the user has it disabled). Some good tutorials for HTML, CSS and PHP can be found at http://www.openzu.com if you would like to learn more.

Michael at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.