My js file
var screenwidth=screen.width;
var screenheight=screen.height;
if(screenwidth == 800 && screenheight == 600)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index860.css" />
}
else if(screenwidth == 1024 && screenheight == 768)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1024.css" />
}
else if(screenwidth == 1152 && screenheight == 864)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1152.css" />
}
else if(screenwidth == 1280 && screenheight == 720)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1280_720.css" />
}
else if(screenwidth == 1280 && screenheight == 768)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1280_768.css" />
}
else if(screenwidth == 1280 && screenheight == 800)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1280_800.css" />
}
else if(screenwidth == 1280 && screenheight == 960)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1280_960.css" />
}
else if(screenwidth == 1280 && screenheight == 1024)
{
<link rel="stylesheet" type="text/css" href="C:/Users/bugra/Desktop/project_site/indexl280_1024.css" />
}
else if(screenwidth == 1360 && screenheight == 768)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1360.css" />
}
else if(screenwidth == 1366 && screenheight == 768)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1366.css" />
}
else if(screenwidth == 1600 && screenheight == 900)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1600_900.css" />
}
else if(screenwidth == 1600 && screenheight == 1024)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1600_1024.css" />
}
else if(screenwidth == 1680 && screenheight == 1050)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index1680.css" />
}
else if(screenwidth == 1920 && screenheight == 1080)
{
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index.css" />
}
html file
<head>
<script type="text/javascript" src="res.js">
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div id="orta"><center>MERHABA BU SITE IPAD PROJESI ICIN TASARLANDI <p> PROJE : LEZZET DUNYASI<p> BURAK KURAL <p> BUĞRA SÖNMEZ <p> GÜRCAN DİNLER <p> BÜKE YOLAÇAN</></div>
</body>
</html>
one of my css
html{
height: 98%;
}
body {
background-color:#000;
background-image:url(rsz_ipad-template-horiz.jpg);
background-repeat:no-repeat;
background-position:50% 50%;
}
#orta {
background-color:#CFF;
background-repeat:no-repeat;
height:431px;
width:698px;
margin-left:602px;
margin-top:262px;
font-size:22px;
font-family:"Courier New", Courier, monospace;
font-style:oblique;
}
}
I try to run this html code on my local computer and all files are in the same folder.
When i click html file , ı just see the result of code which is written between .
Firstly i wrote internal js than use external maybe that was the reason but nothing changed.
For another solution , tried to
document.write('<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index860.css" />');
instead of
<link rel="stylesheet" type="text/css" href="C:\Users\bugra\Desktop\project_site\index860.css" />
again nothing changed.
I looked at the code but i didn’t see any syntax error in it. I’m new at js so maybe i miss sometihng but i cant find it.
You messed up javascript with html. You can’t put markup in JS file. If you wan’t print something to page you should use
document.writeln('...'). Example:Also href in link tag is not right. It should be url. If you want link file from local disk you should write it as
file:///C:/Users/bugra/Desktop/project_site/index860.css.