将参数传递给样式表,例如" mystyle.css颜色= FFFFFF&QUOT?; [英] Passing parameters to style sheet, e.g. "mystyle.css?color=ffffff"

查看:64
本文介绍了将参数传递给样式表,例如" mystyle.css颜色= FFFFFF&QUOT?;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将参数传递给样式表?我注意到一对

的网站现在将变量传递给样式表,这似乎在运行时被替换为
。例如:


< link rel =" stylesheet" type =" text / css"

href =" mystyle.css?color = ffffff">


我在临时互联网上看到过引用文件目录

表示这是可能的,但我找不到任何文件如何

这样做。


我怀疑mystyle.css页面实际上是asp或aspx页面

a替换类似于<%=

Request.QueryString(" color") %> ;,但我不能让它工作。


谢谢,


Roger

How can I pass parameters to a style sheet? I have noticed a couple
of sites are now passing variables to the style sheet, which appear to
be substituted at run time. For example:

<link rel="stylesheet" type="text/css"
href="mystyle.css?color=ffffff">

I have seen references in my temp Internet file directory that
indicates this is possible, but I can''t find any documentation how to
do it.

I suspect the mystyle.css page is really an asp or aspx page they does
a substitution with via something like <%=
Request.QueryString("color")%>, but I can''t get this to work.

Thanks,

Roger

推荐答案



" Roger" < RJ ***** @ viewcentral.com>在消息中写道

新闻:ef ************************** @ posting.google.c om ...

"Roger" <rj*****@viewcentral.com> wrote in message
news:ef**************************@posting.google.c om...
如何将参数传递给样式表?我注意到有几个网站现在将变量传递给样式表,这些变量似乎在运行时被替换。例如:

< link rel =" stylesheet" type =" text / css"
href =" mystyle.css?color = ffffff">

我看到我的临时Internet文件目录中的引用
表示这是可能的,但我找不到任何文档如何做到这一点。

我怀疑mystyle.css页面实际上是asp或aspx页面
使用类似于<%=
Request.QueryString(" color")%>的替换,但我无法使其工作。
How can I pass parameters to a style sheet? I have noticed a couple
of sites are now passing variables to the style sheet, which appear to
be substituted at run time. For example:

<link rel="stylesheet" type="text/css"
href="mystyle.css?color=ffffff">

I have seen references in my temp Internet file directory that
indicates this is possible, but I can''t find any documentation how to
do it.

I suspect the mystyle.css page is really an asp or aspx page they does
a substitution with via something like <%=
Request.QueryString("color")%>, but I can''t get this to work.




我认为它必须是那样的。但是你需要配置你的
网站来处理带有.CSS扩展名的请求作为ASP(X)请求,并且

需要添加


<%Response.ContentType =" text / css" %>


位于CSS文件的顶部。或者你可以跳过.CSS扩展名,

并且


href =" mystyle.asp?color = #ffffff"


然后你可以跳过服务器配置部分,只需设置内容

类型并将mystyle.css重命名为mystyle.asp。



I''d think it would have to be that. But then you''d need to configure your
web site to treat requests with the .CSS extension as ASP(X) requests, and
would need to add

<% Response.ContentType = "text/css" %>

at the top of the CSS file. Alternatively you could skip the .CSS extension,
and have

href="mystyle.asp?color=#ffffff"

Then you could skip the server configuration part and just set the content
type and rename mystyle.css to mystyle.asp.


谢谢哈伦。简单地使用.asp页面而不是.css页面允许

查询字符串进程并且似乎工作,至少在IE 6下。


你呢认为任何浏览器都对.css扩展名敏感,或者

如果所有浏览器都访问任何样式表引用,只要html文件中的

引用是正确的并且样式表有

正确的语法?


再次感谢,


Roger
Thanks Harlan. Simply using an .asp page instead of a .css page allows
the query string process and appears to work, at least under IE 6.

Do you think any browsers are sensitive to the .css extension, or
should all browswers access any style sheet reference, as long as the
reference in the html file is correct and the style sheet has the
correct syntax?

Thanks again,

Roger




< rj ***** @ viewcentral.com>在消息中写道

news:10 ********************* @ c13g2000cwb.googlegro ups.com ...

<rj*****@viewcentral.com> wrote in message
news:10*********************@c13g2000cwb.googlegro ups.com...
谢谢哈伦。简单地使用.asp页面而不是.css页面允许查询字符串进程并且似乎工作,至少在IE 6下。

您认为任何浏览器都对它敏感吗? css扩展,或
应该所有浏览器访问任何样式表引用,只要html文件中的
引用是正确的并且样式表具有正确的语法?
Thanks Harlan. Simply using an .asp page instead of a .css page allows
the query string process and appears to work, at least under IE 6.

Do you think any browsers are sensitive to the .css extension, or
should all browswers access any style sheet reference, as long as the
reference in the html file is correct and the style sheet has the
correct syntax?




后者。所有浏览器都会将命名资源

的请求逐字地发送回服务器。通过将生成图像的ASP文件的URL放在

IMG标记的SRC属性中,相同的技术可以动态地生成图像。



The latter. All the browser does is send a request for the named resource
back to the server verbatim. The same technique works for dynamically
generating images, by putting the URL for an image-generating ASP file in
the SRC attribute of an IMG tag.


这篇关于将参数传递给样式表,例如&QUOT; mystyle.css颜色= FFFFFF&QUOT?;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆