Javascript 尝试更改有关屏幕大小的图片时出现问题

Javascript 尝试更改有关屏幕大小的图片时出现问题,javascript,html,Javascript,Html,嗨,我想做一页我的课程,我想改变顶部的照片取决于屏幕上的大小 我试图使用Javascript,但不起作用 我得到以下错误: Curriculum.html:33 Uncaught SyntaxError: Unexpected end of input Curriculum.html:37 Uncaught SyntaxError: Unexpected token '}' Curriculum.html:41 Uncaught SyntaxError: Unexpected token '}'

嗨,我想做一页我的课程,我想改变顶部的照片取决于屏幕上的大小

我试图使用Javascript,但不起作用

我得到以下错误:

Curriculum.html:33 Uncaught SyntaxError: Unexpected end of input
Curriculum.html:37 Uncaught SyntaxError: Unexpected token '}'
Curriculum.html:41 Uncaught SyntaxError: Unexpected token '}'

foto_curriculum_1200.png:1 Failed to load resource: net::ERR_FILE_NOT_FOUND

foto_curriculum_1000.png:1 Failed to load resource: net::ERR_FILE_NOT_FOUND


当然,如果我试着不考虑图片的大小就画图画,那就行了,所以路线就行了。 我的项目代码如下:


<script>


var width = screen.width; 
var height = screen.height;

alert('Welcome to my personal Page!');

  </script>

   <body onload=animar() >
       <div class="main_container">
           
               <div>
                   <h1><i>Manuel Lucas Sánchez</i></h1>

                   <script>if(width>=1200 && height>=1600){</script>

                       <img class="foto_cabecera" src="../img/foto_curriculum_1200.png" alt="foto_1200">

                   <script>}else{</script>

                       <img class="foto_cabecera" src="../img/foto_curriculum_1000.png" alt="foto_1000">
                       
                   <script>}</script>
                   
                  
                   
               </div>
               <p><i>Biotecnólogo, apasionado por la tecnología, y futuro desarrolllador de aplicacciones.</i></p>
           
       </div>


变量宽度=屏幕宽度;
变量高度=屏幕高度;
警报(“欢迎访问我的个人页面!”);
曼努埃尔·卢卡斯·桑切斯
如果(宽度>=1200和高度>=1600){
}否则{
}
Biotecnólogo,apasionado por la Tecnologaía,y futuro desarrolllador de aplicacciones

我从标签上读到它是可行的,但也不起作用


谢谢你的进步

这不是html/javascript中脚本的工作方式

您收到此错误是因为脚本未完成。每个脚本标记中都需要有一个工作脚本。简单的
{
不是可执行代码,因此会引发错误


我建议您研究一些可以帮助您实现这一点的工具。尝试研究Angular、Node或JQuery等框架。

这不是html/javascript中脚本的工作方式

出现此错误是因为脚本未完成。每个脚本标记中都需要一个工作脚本。简单的
{
不是可执行代码,因此会引发错误


我建议您研究一些可以帮助您实现这一点的工具。试着研究Angular、Node或JQuery等框架。

您需要一个合适的工作
脚本
您不能有
}

您需要一个合适的工作
脚本
您不能有