SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I use the same css for my pages?

    I have to include Javascript, asp (I don't know if I should include the "include file")

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>CSS Template - Two Column Fixed Width with Header &amp;
    Footer</title>
    <meta http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1" />
    <meta name="Robots" content="NOINDEX" />
    <meta http-equiv="PRAGMA" content="NO-CACHE" /><!--
      Web Site: www.ssi-developer.net
      Comments: Copyright 2003 www.ssi-developer.net
      Licence:  Creative Commons - Non-commercial Share-Alike
    -->
    
    <link rel="stylesheet" type="text/css"
    href="2c-hd-ft-fixed-layout.css" />
    <link rel="stylesheet" type="text/css"
    href="2c-hd-ft-fixed-presentation.css" />
    
    
    <style type="text/css">
    /*<![CDATA[*/a.piclink:active{color:red;background-color:grey;text-decoration:none}
    a.piclink:visited{color:blue;background-color:grey;text-decoration:none}
    a.piclink:hover{color:#B36B00;background-color:white;text-decoration:none}/*]]>*/
    </style>
    
    <script language="Javascript">
    //<!--Hide script from old browsers
    function setpic(x) {
    //if (isNaN(x) == true) {
    //	eval("document['" + x.toLowerCase() + "'].src = '/nav_redarrow.gif'")
    //} else {
    //	eval("document['pic" + x + "'].src = '/nav_redarrow.gif'")
    //}
    }
    
    function changeIcon(pic,motion) {
    if (document[pic].src.indexOf('/nav_redarrow.gif') == -1) {
    	if (motion.indexOf("over") != -1) {
    		document[pic].src = 'wheel.gif'	
    	} else if (motion.indexOf("out") != -1) {
    		document[pic].src = 'greywheel.gif'	
    	} else {
    		document[pic].src = motion
    	}			
    }
    }
    
    function ci(pic,motion) {
    if (document[pic].src.indexOf('/nav_redarrow.gif') == -1) {
    	if (motion.indexOf("over") != -1) {
    		document[pic].src = 'wheel.gif'	
    	} else if (motion.indexOf("out") != -1) {
    		document[pic].src = 'greywheel.gif'	
    	} else {
    		document[pic].src = motion
    	}			
    }
    }
    
    //-->
    </script>
    
    </head>
    Compare bible texts (and other tools):
    TheWheelofGod

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Put your CSS in a .CSS file and link to it using
    <link rel="stylesheet" type="text/css" href="mystyle.css"/>

    Similarly the javascript
    <script language="JavaScript" src="myjavascript.js"></script>

  3. #3
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ok

    I'll get to it. But in the meantime I was wondering about the <head></head>. Doesn't javascript have to be in the head?
    Compare bible texts (and other tools):
    TheWheelofGod

  4. #4
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well yes and no ...... embedded javascript should be in the head and YES the link to external js (the one shown in the last post) has to be in the head but its FAR MORE efficient to have the js in an external file (and a lot easier to update)

    and BTW the language attribute in this link is deprecated:

    <script language="JavaScript" src="myjavascript.js"></script>

    it should read

    <script type="text/javascript" src="myjavascript.js"></script>

  5. #5
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    in that case...in separate folder(s)

    In that case I would prefer to see them in separate folder(s) to be organized. Is that possible? I tried
    Code:
    <link rel="stylesheet" type="text/css"
    href="css/2c-hd-ft-fixed-layout.css" />
    <link rel="stylesheet" type="text/css"
    href="css/2c-hd-ft-fixed-presentation.css" />
    and
    Code:
    <link rel="stylesheet" type="text/css"
    href="/css/2c-hd-ft-fixed-layout.css" />
    <link rel="stylesheet" type="text/css"
    href="/css/2c-hd-ft-fixed-presentation.css" />
    But it's not working.
    Compare bible texts (and other tools):
    TheWheelofGod

  6. #6
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sure can .... I use a scripts folder for my js and a style folder for my styles like this:

    Code:
    <script type='text/javascript' src='/scripts/my_scripts.js'></script>
    <link rel='stylesheet' type='text/css' href='/styles/my_stylesheet.css' media="screen" />

  7. #7
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    not working

    WHy doesn't this work?
    Code:
    <link rel='stylesheet' type='text/css' href='/css/2c-hd-ft-fixed-layout.css' media="screen" />
    I have it in a folder called "css".
    Compare bible texts (and other tools):
    TheWheelofGod


Bookmarks

Posting Permissions

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