Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder hedbanger's Avatar
    Join Date
    Jun 2002
    Location
    vallejo, ca
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    alternative style sheet

    i am calling a remote page into frames at 6 different locations. i want a different style sheet depending on which location.
    Code:
    <script language="javascript" type="text/javascript">
    	if (frame.name='AmainFrame') {
    		document.write '<style type="text/css">
    <!--
    @import url("http://www.meyer.com/A.css");
    -->
    </style>'
    }
    </script>
    jf~ if you're not part of the solution, you're part of the precipitate.

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your document.write statement(s) need to be within params ( ... ) and either on one line or broke across several statements as I have done below.... I would also reference the frame name thru the document.frames collection but I am unsure if your use in the if conditional is correct....

    Code:
    <script type="text/javascript">
      if(document.frames['AmainFrame']) {
         document.writeln('<style type="text/css">');
         document.writeln('<!--');
         document.writeln('@import url("http://www.meyer.com/A.css")');
         document.writeln('-->');
         document.writeln('</style>');
      }
    </script>
    .....Willy

  • #3
    New Coder hedbanger's Avatar
    Join Date
    Jun 2002
    Location
    vallejo, ca
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well that certainly looks much better, but it's still not working.

    i'm now wondering if anything along this line will work.
    i'm starting to think that since the remote file doesn't "know" where it's going until it goes it's too late to call the css.

    should it work, do you think?

    what other methods might there be to accomplish this?
    jf~ if you're not part of the solution, you're part of the precipitate.

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Don't know...

    I already said that this does not look right: if(document.frames['AmainFrame']) {

    Either way it is said: if (frame.name='AmainFrame') {

    It doesn't make sense to me but I am not privy to the context it is being used in so.....

    .....Willy


  •  

    Posting Permissions

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