• 0

New to Javascript. need help


Question

Hey all I just read all the chapters on javascript from w3schools and I kind of feel like I didn't read anything because I don't really know how to do anything. I am trying to create something that will change the stylesheet when a button is clicked, but I can't figure out what to do! :( I tried to read examples online and I get the feeling that this is out of my league right now. :(

Here's what I go so far. Keep in mind that I'm new and I know it's wrong and probably makes no sense lol, but I'm stuck.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link id="thecss" rel="stylesheet" type="text/css" href="./style.css">
<script type="text/javascript">
function redcss(document.getElementById("thecss").href)
{
document.write("./style2.css");
}

function blackcss(document.getElementById("thecss").href)
{
document.write("./style.css");
}

<!--
var blackcss="./style.css";
var redcss="./style2.css";
-->
</script>
</head>
<body>
<div id="test">
</div>

<input type="button" value="RED" onclick="redcss()"/><input type="button" value="BLACK" onclick="blackcss()"/>

</body>
</html>

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.