|
-
May 29th, 2008, 09:12 AM
#1
Thread Starter
Fanatic Member
Optional CSS templates on the same page
How would I have a page that loads with one CSS document, then when they click a box somewhere, the CSS file will change and the site will look different. I want to have the user be able to dynamically change the appearance of the site to different files i create, so they can pick the one they like best
Software languages known:
Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known:
Directx 7 and 8
Internet languages, in the process of learning:
HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
-
May 29th, 2008, 10:54 AM
#2
Re: Optional CSS templates on the same page
Hi there damasterjo,
have a look at this example, it may suit your requirements...
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link id="styles" rel="stylesheet" type="text/css" href="style1.css">
<script type="text/javascript">
window.onload=function(){
document.getElementById('choice').onchange=function() {
document.getElementById('styles').href=this.value;
}
}
</script>
</head>
<body>
<div>
<select id="choice">
<option value="style1.css">style one</option>
<option value="style2.css">style two</option>
<option value="style3.css">style three</option>
<option value="style4.css">style four</option>
</select>
</div>
</body>
</html>
coothead
-
May 29th, 2008, 02:37 PM
#3
Thread Starter
Fanatic Member
Re: Optional CSS templates on the same page
im sorry this dosent change the file when i choose an option, why not?
Software languages known:
Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known:
Directx 7 and 8
Internet languages, in the process of learning:
HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
-
May 29th, 2008, 05:05 PM
#4
Re: Optional CSS templates on the same page
~ the original bald headed old fart ~
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|