Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Browser 如何让浏览器在加载页面后下载外部文件?_Browser_Stylesheet_Pageload - Fatal编程技术网

Browser 如何让浏览器在加载页面后下载外部文件?

Browser 如何让浏览器在加载页面后下载外部文件?,browser,stylesheet,pageload,Browser,Stylesheet,Pageload,好吧,我的问题很简单。假设我有一个没有链接到任何外部样式表的主页,它的所有样式都是内联的或内部的,我该如何做才能在下载并显示主页之后,浏览器下载任何必要的(指定的)外部样式表。这可能吗 谢谢。试试这个: <head> <script type='text/javascript'> function addstyle() { document.getElementById('style').href='style.css';

好吧,我的问题很简单。假设我有一个没有链接到任何外部样式表的主页,它的所有样式都是内联的或内部的,我该如何做才能在下载并显示主页之后,浏览器下载任何必要的(指定的)外部样式表。这可能吗


谢谢。

试试这个:

<head>
   <script type='text/javascript'>
      function addstyle()
      {
        document.getElementById('style').href='style.css';
      }
   </script>
   <link rel="stylesheet" type="text/css" href="">
</head>
<body onload="addstyle()">
   <h1>Welcome</h1>
   <p>Hello whats up</p>
   <p>Hope you will have a great day</p>
</body>

函数addstyle()
{
document.getElementById('style').href='style.css';
}
欢迎
你好,怎么了

希望你今天过得愉快


这个问题可能会给你一个提示:[link][1][1]: