Is it okay to do this?
so I can use JavaScript to d
Yup, it is. It is not recommended though, as this'd mean loading several files (multiple HTTP requests) as opposed to loading one bigger file (but one HTTP request only).
According to HTML 4.01 Transitional, id, class are document-wide selectors, and thus it is ok to have them in the link element.
Yes, you can. The core attributes are allowed on the <link> element, which includes style, class, id, and title. Although, since it's not a rendered element, classes and styles won't have any effect.
<!ENTITY % coreattrs
"id ID #IMPLIED -- document-wide unique id --
class CDATA #IMPLIED -- space-separated list of classes --
style %StyleSheet; #IMPLIED -- associated style info --
title %Text; #IMPLIED -- advisory title --"
>
Yes. There are certain attributes that may be specified on every html element. id and class are among them.
For a complete list in the html5 spec: http://developers.whatwg.org/elements.html#global-attributes
The spec for the link element: http://developers.whatwg.org/semantics.html#the-link-element
And in html4.1: http://www.w3.org/TR/html401/struct/links.html#h-12.3