~~~ Please read before posting. ~~~

Important: We need your Club Number at a minimum, and as many details as possible.
For further info please read This page before posting.

Another Javascript Mishap

  • DavidBrown
  • DavidBrown's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thanks: 0

Another Javascript Mishap

11 years 7 months ago
#33143
Club #4545
heightstoastmasters.com

I had a similar mishap on Friday. I tried to add the following snippet of Javascript:

<script type="text/javascript>
var q=document.getElementById("accordion2").getElementsByTagName("span");
var loggedIn=false;
for (var i = 0; i<q.length;i++){
if (q.classname="unlocked") loggedIn=true;
}
if (loggedIn) alert("Hi Dave");
</script>

Trying to get something different to happen if the user is logged on. (I now see I left out the closing quotes in the "type" tag, and I wouldn't be surprised of the "loggedIn" variable collided with something. Also, no <span> EVER has a class name "unlocked".)

Anyway, the main page loads, but the login links don't work. I can log in as administrator from other pages on the site, but the admin console won't launch, so I can't remove the snippet. Once again, I ask that you remove the offending Javascript snippet from the editable "home page" box.

With apologies,
David Brown
Heights Toastmasters, Club #4545
The topic has been locked.
  • Brian
  • Brian's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 10649
  • Thanks: 3580

Re: Another Javascript Mishap

11 years 7 months ago
#33144
David:

I suggest you test your java scripts before posting them on your site.

I have removed the offending code.
The topic has been locked.
  • DavidBrown
  • DavidBrown's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thanks: 0

Re: Another Javascript Mishap

11 years 7 months ago
#33145
Good idea. Thanks again.

David Brown
Heights Toastmasters, Club #4545
The topic has been locked.
  • SteveTheTechie
  • SteveTheTechie's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 11526
  • Thanks: 3050

Re: Another Javascript Mishap

11 years 7 months ago - 11 years 7 months ago
#33146
Dave,

What you are doing will likely get broken in a few months anyway. I intend to change some of the references you making use of. (e.g., accordion2)
Last edit: 11 years 7 months ago by SteveTheTechie.
The following user(s) said Thank You: DavidBrown
The topic has been locked.
Moderators: BrianHeniPamrhtaylor3marc33NotLiablejgavinLcala305peterb323DebbieT
Time to create page: 0.152 seconds