List Info

Thread: Getting JS error message. Why?




Getting JS error message. Why?
country flaguser name
United States
2007-09-03 20:03:07

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&quot; id="btnSkin"; value=&quot;Change Skin" onclick=&quot;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&quot;

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&quot; type=";text/css&quot; href=";koreacss.css" />
<link rel="alternate stylesheet" type=";text/css&quot;
href=&quot;koreacss2.css&quot; />

__._,_.___
Recent Activity
Visit Your Group
Search Ads

Get new customers.

List your web site

in Yahoo! Search.

Find Enlightenment

Yoga groups and

resources on

Yahoo! Groups.

Re: Getting JS error message. Why?
country flaguser name
United States
2007-09-04 14:46:33

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&quot;);
var btn = document.getElementById("btnSkin";);

Still getting error, however.
Thanks again,

Frank

--- In JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com, "Frank" <maybush1...>
wrote:
>
&gt; 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:
&gt;
> <input type=";button&quot; id="btnSkin"; value=&quot;Change Skin" onclick=&quot;Skin2
> ();" />
&gt;
> Here are the JS functions:
>
> <script type=";text/javascript";>
>; function Skin1()
> {
> link[0].setAttribute("disabled", "false");
> link[1].setAttribute("disabled", "true");
> btn.onclick = Skin2;
&gt; }
>
> function Skin2()
> {
> link[0].setAttribute("disabled", "true");
> link[1].setAttribute("disabled", "false");
> btn.onclick = Skin1;
&gt; }
> </script>
>;
> And here is the error message when pressing the "btnSkin" button:
>
> "Microsoft JScript runtime error: 'btn' is null or not an object&quot;
>
> 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!
&gt;
> Frank
&gt;
> P.S. Here are the two CSS file calls, btw:
>;
> <link rel="stylesheet&quot; type=";text/css&quot; href=";koreacss.css" />
&gt; <link rel="alternate stylesheet" type=";text/css&quot;
> href=";koreacss2.css" />
&gt;

__._,_.___
Recent Activity
Visit Your Group
Search Ads

Get new customers.

List your web site

in Yahoo! Search.

Yahoo! Groups

Going Green

Share your passion

for the planet.

Yoga Resources

on Yahoo! Groups

Take the stress

out of your life.

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )