Hi, I trying to use one of two style sheets depending on screen size but it is not working. Here is the code:

<script type="text/javascript">
if(screen.width>= 900){
	document.write('<link href="main.css" rel="stylesheet" type="text/css" />');
}else {document.write('<link href="small.css" rel="stylesheet" type="text/css" />');
}
</script>

It disables the style sheets altogether. Not sure why.
Any suggestions?
Thanks

Solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.