document.write颜色 [英] document.write colour

查看:151
本文介绍了document.write颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在脚本中使用以下语句:


If(res == 123)document.write(" Blah Blah");

else

document.write(" XYZ");


这当然会在我的网站上打开一个新页面并打印出Blah Blah。

但是,页面的颜色是白色和我希望它匹配原始请求发送到的html页面的颜色

。我已经尝试了



document.write(''< body bgcolor =" green">'')但我要么把它放在

错误的地方或它不起作用。


有人可以帮忙吗?


杰夫。

I am using the following statement in a script:

If (res == 123) document.write (" Blah Blah");
else
document.write (" XYZ");

This of course brings up a new page on my site and prints Blah Blah.
However, the colour of the page is white & I want it to match the colour of
the html page from which the original request was sent. I have tried
playing with
document.write(''<body bgcolor="green">'') but either I''m placing it in the
wrong place or it doesn''t work.

Can anyone help please?

Geoff.

推荐答案

Geoff在1/26/2006上午7:44发表以下内容:
Geoff said the following on 1/26/2006 7:44 AM:
我使用以下语句在脚本中:

if(res == 123)document.write(" Blah Blah");

document.write(" XYZ");

这当然会在我的网站上打开一个新页面并打印出Blah Blah。


同一个浏览器窗口中的新页面我假设你是什么意思。

然而,页面的颜色是白色&我希望它与发送原始请求的html页面的颜色相匹配。我试过用
document.write(''< body bgcolor =" green">'')玩,但要么把它放在
错误的地方,要么它不起作用。
I am using the following statement in a script:

If (res == 123) document.write (" Blah Blah");
else
document.write (" XYZ");

This of course brings up a new page on my site and prints Blah Blah.
New page in the same browser window I assume is what you mean.
However, the colour of the page is white & I want it to match the colour of
the html page from which the original request was sent. I have tried
playing with
document.write(''<body bgcolor="green">'') but either I''m placing it in the
wrong place or it doesn''t work.




显示一些实际代码。没有人看到

代码就像任何回答一样,没有人能回答你的问题。必须猜测。


-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组每周

Javascript最佳实践 - http://www.JavascriptToolbox .com / bestpractices /



Show some actual code. Nobody will be able to answer you without seeing
the code as any "answer" given would have to be a guess.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


2006年1月26日星期四12:44:45 +0000,Geoff写道:
On Thu, 26 Jan 2006 12:44:45 +0000, Geoff wrote:
我在脚本中使用以下语句:

if(res == 123)document.write(" Blah Blah");


文档。写(XYZ);

这当然会在我的网站上打开一个新页面并打印Blah Blah。
然而,页面的颜色是白色和我希望它与发送原始请求的html页面的颜色相匹配。我试过玩


document.write(''< body bgcolor =" green">'')但是我要把它放在


不太清楚你想要做什么,但改变你的背景

颜色可能会起作用......


document.body.style.background =" green";

错误的地方或它不起作用。

任何人都可以帮忙吗?

Geoff。
I am using the following statement in a script:

If (res == 123) document.write (" Blah Blah");
else
document.write (" XYZ");

This of course brings up a new page on my site and prints Blah Blah.
However, the colour of the page is white & I want it to match the colour of
the html page from which the original request was sent. I have tried
playing with
document.write(''<body bgcolor="green">'') but either I''m placing it in
Not quite clear what you''re trying to do but changing your background
color may work by...

document.body.style.background = "green";
the wrong place or it doesn''t work.

Can anyone help please?

Geoff.




发布你的消息来源。


到目前为止

Rob



Post your sources.

So far

Rob


好的,我正在做的是从HTML页面输入一个输入的号码和

如下处理它(这是相关部分):


函数check_input()

{

//从表单中的文本字段获取用户输入id的f

var entry = document.forms.f.textfield.value;

//输入数字

var num2 = entry.substr (0,3);

var res = + num2;

//测试正确性

if(res == 936)document.write(这是正确的数字);

else

if(res == 938)document.write(这是正确的数字);

else

if(res == 939)document .write(这是正确的数字);

else

if(res == 941)document.write(" This is the right number") ;);

其他

如果(res == 942)document.write(这是正确的数字);

否则

如果(res == 943)document.write(这是正确的数字);

else

文件。写(不幸的是,这是错误的数字);

}


如果结果等于其中一个数字,它将获取一个新页面

,带有这是正确的数字相反,这是错的

数字如果它不匹配。这一切都运行正常,但是用这个文字显示的新页面是

,是白色的,我想把它变成绿色。


希望这个让它更清楚。


提前致谢,
OK, What I am doing is taking an inputted number from an HTML page and
processing it as follows (This is the relevant part):

function check_input()
{
// get user input from text field in form id of f
var entry = document.forms.f.textfield.value;
// Input number
var num2 = entry.substr(0,3);
var res = +num2;
// Test for correctness
if(res == 936) document.write ("This is the correct number ");
else
if(res == 938) document.write ("This is the correct number ");
else
if(res == 939) document.write ("This is the correct number ");
else
if(res == 941) document.write ("This is the correct number ");
else
if(res == 942) document.write ("This is the correct number ");
else
if(res == 943) document.write ("This is the correct number ");
else
document.write (" Unfortunately, This is the wrong number ");
}

If the result is equal to one of these numbers, it will fetch a new page
with "This is the correct number" and conversely, "This is the wrong
number" if it doesn''t match. This all works OK, but the new page which is
displayed with this text in, is White and I want to make it a Green.

Hope this makes it clearer.

Thanks in advance,

Geoff。

Geoff.



这篇关于document.write颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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