Get head element in pure JS:
var head = document.head || document.getElementsByTagName("head")[0];
Get first style element in pure JS:
var style = document.getElementsByTagName("style")[0];
Get first style element in Prototype JS:
var style = $$("style").first();
Modification of text in existing style element IMHO may be different in IE and W3C-compliant browsers - IE can modify content of style via property style.styleSheet.cssText, W3C browsers via DOM style.childNodes[0] or property style.innerText.