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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you personalize a web page?

Status
Not open for further replies.

specialist

Programmer
Sep 7, 2001
50
US
greetings-

I am starting to begin a feature which will allow users to personalize their web experience on my site (much like yahoo which allows you to cusomize your perfered colour schemes and such).

Where do I start? Is this a CSS issue of JavaScript issue?

Please help!

Any advice would be kindly welcomed.

gracias,
 
Hi Specialist,
It is dHTML (there, wasn't that helpful :)
But here is some javascript/HTML that will allow your users to change the background color of the page. Remember that the background color is only visible on pages without an opaque background image!
As for permanantly SAVING it the next time they come to the site.......
And as for having them change other stuff........
But, here is a start anyway!

<html>
<head>
<SCRIPT language=&quot;JavaScript&quot;>
function changeBackground(hexNumber) {
document.bgColor=hexNumber;
}
</SCRIPT>
</head>

<body>
<FORM method=&quot;post&quot; name=&quot;background&quot;>
<INPUT type=&quot;button&quot; value=&quot;red&quot;
onclick=&quot;changeBackground('#cc0000')&quot;>
<INPUT type=&quot;button&quot; value=&quot;green&quot;
onclick=&quot;changeBackground('#006600')&quot;>
<INPUT type=&quot;button&quot; value=&quot;yellow&quot;
onclick=&quot;changeBackground('#ffff99')&quot;>
<INPUT type=&quot;button&quot; value=&quot;white&quot;
onclick=&quot;changeBackground('#ffffff')&quot;>
<INPUT type=&quot;button&quot; value=&quot;black&quot;
onclick=&quot;changeBackground('#000000')&quot;>
<INPUT type=&quot;button&quot; value=&quot;grey&quot;
onclick=&quot;changeBackground('#666666')&quot;>
</FORM>
</body>
</html>

Regards,
- Omicron -
 
To store the info you need to write a cookie that stores the set variables. I set my page to green, so the cookie will have that variable in it written to my machine. When the page loads you need to check for the existence of that cookie. Yahoo does this through server side and a login that most likely stores the preferences in a database of sorts DeZiner
gear.gif width=45 align=left
When the gears stop turning,
we all stop learning.
 
DeZiner, what would all of us do if your gears would stop running? damn! i'll die without learning!! or else i would become stupid & dumb!! i don't want to!
take care of them, ok?
Victor
 
here's how you would do the cookie:

expireDate = new Date
expireDate.setMonth(expireDate.getMonth()+6);
var color = document.bgColor

document.cookie = &quot;bgColor=&quot; + color + &quot;;expires=&quot; + expireDate.toGMTString();



then to get it back:

thisCookie = document.cookie.split(&quot;; &quot;);

for (i=0; i<thisCookie.length; i++) {
if (thisCookie.split(&quot;=&quot;)[0] == &quot;bgColor&quot;) {
var newBg = &quot;#&quot; + thisCookie.split(&quot;=&quot;)[1]
document.bgColor = newBg
}
}

hope that helps!


-Greg :-Q
 
this is a real good post,
ok now we have a mean to write a cookie
next how do we write a simple offering like
bg blue or gray
font Arial or tahoma

JS might not be a prime candidate for too many users do not upgrade browsers etc..
of course depands on your primary and secondary target

cheers
 
its all pretty much simple js that should be supported by everything (although u never can tell with netCrap)

omicrom has the right idea for the colors, for the fonts you would have to have them choose the font the reload and use js to document.write some css...let me know if u need examples.. -Greg :-Q
 
mackey33,
thanks
I will try some experiments, CSS is my favorite
JS is my minor,

on another hand I need to take on PHP for mySQL
but cannot ignore JS (Which I have done too much!)

never ending......
 
Thank you to everyone who has responded to this post, I certainly have all I need to set this up.

Muchos Gracias!

-mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top