I forgot to mention that I did declare the button, by the way. Here
is the code (outside of the functions):
var link = document.getElementsByTagName("link");
var btn = document.getElementById("btnSkin");
Still getting error, however.
Thanks again,
Frank
--- In JavaScript_Official%40yahoogroups.com">JavaScript_Official
yahoogroups.com, "Frank" <maybush1
...>
wrote:
>
> Hi everyone,
>
> I am trying to do a very simple CSS file switch to change the skin
of
> my site by toggling though with a button in ASP.NET and function
> calls in JavaScript. Here is the pertanent ASP.NET code:
>
> <input type="button" id="btnSkin" value="Change Skin" onclick="Skin2
> ();" />
>
> Here are the JS functions:
>
> <script type="text/javascript">
> function Skin1()
> {
> link[0].setAttribute("disabled", "false");
> link[1].setAttribute("disabled", "true");
> btn.onclick = Skin2;
> }
>
> function Skin2()
> {
> link[0].setAttribute("disabled", "true");
> link[1].setAttribute("disabled", "false");
> btn.onclick = Skin1;
> }
> </script>
>
> And here is the error message when pressing the "btnSkin" button:
>
> "Microsoft JScript runtime error: 'btn' is null or not an object"
>
> Any odeas as to what is going on? I can't seem to get any SIMPLE JS
> to run within my projects. Wierd. Thanks for any help!
>
> Frank
>
> P.S. Here are the two CSS file calls, btw:
>
> <link rel="stylesheet" type="text/css" href="koreacss.css" />
> <link rel="alternate stylesheet" type="text/css"
> href="koreacss2.css" />
>