[英]Is it posible to separate Javascript and CSS code from HTML code in a Visual Studio C++ project?
In my project I have several HTML-JavaScript-CSS code and I want to split them into different files. 在我的项目中,我有几个HTML-JavaScript-CSS代码,我想将它们分成不同的文件。 The control I am using is derived from ATL CAxWindow.
我使用的控件是从ATL CAxWindow派生的。
Environment: Microsoft Visual Studio 2010 Professional.
环境:Microsoft Visual Studio 2010专业版。
Programming Language: C++, JavaScript, HTML.
编程语言:C ++,JavaScript,HTML。
The problema arises when I try to separaste the scripting and style codes into separate files. 当我尝试将脚本和样式代码分成单独的文件时,就会出现问题。 The HTML document generated won't detect those files since they're not included in the resources of the Project, like the HTML document is.
生成的HTML文档不会检测到这些文件,因为它们没有像HTML文档那样包含在Project的资源中。
Do you know how can I include those? 你知道我怎么包括那些吗?
Thanks beforehand. 预先感谢。
Actually you have to include both, .css and .js files in the Visual Studio environment by adding the resources to the project. 实际上,您必须通过将资源添加到项目中来在Visual Studio环境中同时包含.css和.js文件。 This will allow to the system to include those on the generated solution and make the files accessible for your HTML code.
这将使系统将那些文件包含在生成的解决方案中,并使文件可用于您的HTML代码。
Once you have included the files on your solution, a number identifying the resource will appear on the resources header file. 将文件包含在解决方案中后,标识资源的数字将出现在资源头文件中。 You have to include that resource identificator as the source for the javascript and css files.
您必须包括该资源标识符作为javascript和css文件的源。 For instance:
例如:
In case my ID is -> 1
I have to write on my html -> <link rel="stylesheet" type="text/css" href="./1">
Hope it helps! 希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.