SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2004
    0 Post(s)
    0 Thread(s)

    importing .js files

    can a .js fil be imported into a document via an external (css) style sheet?

    i'm trying to combine a style switcher with the curvy corners script. it switches, but the display is funky until you refresh the page.

    what i need to do is get any reference to the curvy corners javascript out of the document so the version that does not use it isn't confused.

    the major part of the curvy corners script is in an external file, and there are some parameters that are set in the head of the document. i want to know if i can put these parameters into a separate .js document, and then import both .js documents through some kind of link or include in the style sheet. i know you can use style sheets to call other style sheets, but can you use them to call .js files?

    hope that makes enough sense for some one to be able to advise.

    thanks in advance :-)

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    West Springfield, Massachusetts
    198 Post(s)
    3 Thread(s)

    importing js with css

    AFAIK there is no way to use CSS to import js files. CSS can call image files, but that's because they used for style. Javascript isn't a style.
    Quote Originally Posted by mtouchette
    display is funky until you refresh the page.
    This could be because your elements' dimensions aren't explicilty defined. Once the page has loaded once it "knows" the dimensions so it reloads OK.
    Maybe you could use javascript to test for support of the script before attempting to use it?


Posting Permissions

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