Eikon 0 Report post Posted December 5, 2005 Hey guys, been trying to do this for a while now, how can i import JavaScript and CSS into my HTML page. I always thought that the javascript code was <script type='text/javascript' src='Date.js'></script>But that doesnt seem to be working. I have them in the same folder and the name is exactly that, but when i try to call a function in Date.js later in my html, it doesn't work. For the CSS... I used<style type="text/css"> @import "MainDesign.css";</style>The MainDesign file has a lot in it, and some of it works but some doesnt. Actually, the only thing that doesnt work is a color of the regular font, heres what i have body{ padding-top: 11em; background-color: #222222; color: #FFFFFF; font: 100% "Trebuchet MS",Verdana,Arial,sans-serif } Oh yeah, one final question. The code that i posted about the CSS, even when the CSS style was incorporated into my main page, the padding-top did not work, is that the correct way to do it? Thanks Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted December 5, 2005 Eikon,It would be nice to be able to view the source of the web page and the entire css file, so please post a link here. There may be something else going wrong besides what you have indicated. Also, for the css issue, what browser are you using? And have you tried another browser? Share this post Link to post Share on other sites
Eikon 0 Report post Posted December 5, 2005 Alright, so here is the linkhttp://forums.xisto.com/no_longer_exists/http://forums.xisto.com/no_longer_exists/Also, i dont think its a problem with the code, althought it may be. When i have the css directly in the file, it works fine. Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted December 5, 2005 (edited) Well, first off, the opening and closing style tags don't belong in the css file. That might be enough to have the css file ignored, and would explain why it didn't work.Secondly, the @import command, although it appears correct in your listing, affects the cascade somehow, but I don't know exactly how. I usually use the link tag for the css files. <link href="your_style_file.css" rel="stylesheet" type="text/css">Change the file name in the link href and it should work fine.Thirdly, you have a "wte" and a "wte1" tag in the html and then some style for it in the css. I don't recognize that tag. Were you trying to set up a class? or did it come out of an html editor of some sort? like dreamweaver?A good reason for the Padding to not be working is because it is defined twice.First in the opening Body of the css file and then about 15 lines down in a line with "html, body". My guess is the second occurence overrides the first.Oh, and for the record, your drop-down menus aren't working, either. I'll let someone else deal with that. I don't do much (any) scripting.Okay, what the heck, I've had a peak at the script and although there are better script coders than me around, I noticed that the script seems to be looking for "LI" and the html in the file is "li" (UPPER vs lower case). Wonder if that explains the menu not working? Edited December 5, 2005 by jlhaslip (see edit history) Share this post Link to post Share on other sites
Tyssen 0 Report post Posted December 5, 2005 Secondly, the @import command, although it appears correct in your listing, affects the cascade somehow, but I don't know exactly how. I usually use the link tag for the css files. <link href="your_style_file.css" rel="stylesheet" type="text/css">Change the file name in the link href and it should work fine.The @import line is fine. The reason it is used is because older browsers (v4) which don't support CSS2 don't understand it which means they don't end up getting sent a bunch of rules that they can't interpret.Your javascript won't work cos it's outside the <head> section of your document. As is the script to get your dropdowns to work.You also don't have a doctype which can give you problems as well. Share this post Link to post Share on other sites
Eikon 0 Report post Posted December 5, 2005 Thanks for the input, still learning all this, so its not very organized or very good... trying to keep learning though.. Thanks. Share this post Link to post Share on other sites