Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function to set bgcolor 1

Status
Not open for further replies.

stephenbruceburch

Technical User
Jun 1, 2002
11
0
0
US
I have a function getBGColor() that checks cookies to set a variable bgcolor (in form "#000000") and if the user doesn't have cookies it sets the variable to a default color. Can I use this function in the HTML
ie
<body bgcolor=&quot;getBGColor();&quot;>
or
<body bgcolor=getBGColor();>
or
<body bgcolor=&quot;getBGColor()&quot;;>

I have tried all three and they don't seem to work but the problem might be somewhere else. I was hoping someone could point me to the right syntax - if it exists so I can continue to debug the rest of the code. thanks
 
see if this helps, not sure when you want to set the color

<html>
<head>
<title>Post</title>
<SCRIPT LANGUAGE=&quot;vbscript&quot;>

Sub changecolor
document.bgcolor = &quot;red&quot;
end sub
</Script>

</head>
<body>
<body topmargin=&quot;0&quot; leftmargin=&quot;0&quot; bgcolor=&quot;white&quot; OnLoad=&quot;changecolor&quot;>
&quot;This is a test message&quot;
</Body>
</head>
</HTML> Regards
Steve Friday
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top