...

View Full Version : I killed my site!!



lrubin28
11-09-2009, 05:40 AM
Hi! I hope I'm posting this in the right forum....

Somehow I killed my navigation menus!! Menus without sub-menus are fine, but I can't get any menu with a sub-menu to expand. What did I do?! Here's the first few (there's about 30 altogether). Hellllppppppp!!!

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="background:images/categories-bg.jpg repeat-x;"><img src="images/categories.jpg" width="217" height="41" /></td>
</tr>
<tr>
<td class="list">
<ul>
<li onclick="show_next('tab1')" class="tab_hover" id="tab1"><a href="/SiteIndex.htm">All Product Index <span class="icon"></span> </a>
<div id="tab1_data" style="display:block;"></div></li>

<li id="tab2" class="tab" onclick="show_next('tab2')"><a href="javascript:void(0);">Adhesives &amp; Sandpaper <span class="icon"></span> </a>
<div id="tab2_data">
<ul>
<li><a href="/surehold.htm">Sure-Hold Super Glue</a></li>
<li><a href="/E6000.htm">E6000</a></li>
<li><a href="/Craftics33.htm">Craftics Acrylic Cement</a></li>
<li><a href="/sandpaper.htm">Sandpaper</a></li>
</ul>
</div>
</li>

<li id="tab3" class="tab" onclick="show_next('tab3')"><a href="javascript:void(0);">Beadable Kits <span class="icon"></span> </a>
<div id="tab3_data">
<ul>
<li><a href="/Bottle_opener.htm">Bottle Opener</a></li>
<li><a href="/BeadableStopper.htm">Beadable Wine Stoppers</a></li>
<li><a href="/BeadPens.htm">Bead Pens</a></li>
</ul>
</div>
</li>

<li id="tab4" class="tab" onclick="show_next('tab4')"><a href="javascript:void(0);">Beads/Cabochons <span class="icon"></span> </a>
<div id="tab4_data">
<ul>
<li><a href="/beads.htm">Fancy Glass Beads</a></li>
<li><a href="/abalone.htm">Abalone, Mother of Pearl</a></li>
<li><a href="/dichroic.htm">Dichroic Cabochons</a></li>
</ul>
</div>
</li>

<li id="tab5" class="tab" onclick="show_next('tab5')"><a href="javascript:void(0);">Bottle Stoppers <span class="icon"></span> </a>
<div id="tab5_data">
<ul>
<li><a href="/Stoppers.htm">Stoppers w/Wood Tops</a></li>
<li><a href="/Stopperbevel.htm">Stoppers w/Bevel Tops</a></li>
<li><a href="/BeadableStopper.htm">Beadable Bottle Stoppers</a></li>
<li><a href="/stoppers_display.htm">Stopper Display Stand</a></li>
</ul>
</div>
</li>

Excavator
11-09-2009, 05:43 AM
Hello Irubin28,
Give us a link to the site. What you've posted is not enough information.

lrubin28
11-09-2009, 05:49 AM
Thanks!!

My website is http://www.polymerclayprojects.com

Excavator
11-09-2009, 06:11 AM
Looks like a bit of cut/paste got out of control?
I found this bit, highlighted in red, that definitely does not belong. Could be more, I did not look further. -

</tr>
<tr>
<td class="bodypart"><table border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top" class="leftNav"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<table border="0" cellspacing="0" cellpadding="0">
<tr>

<table width="100%" border="0" cellpadding

Run it all through the validator and see what errors you can fix. See the links about validation in my sig below.

lrubin28
11-09-2009, 06:52 AM
Sorry - I'm not sure I did it right. I didn't see any errors that looked like they were related. I did use a tool inside Expression Web - the web tool I have and it noted 65 instances of "undefined class"...I am not sure I understand why everything was working fine for a year or more, and suddenly it doesn't....?

Rowsdower!
11-09-2009, 01:55 PM
Did you mess with your javascript at all recently?

In Firebug your script is throwing an error in the hideAll() function. It says that "document.getElementById(tabdata) is null" which means that you should be error checking before trying to set the style.display value.

Try this and see if functionality returns:

function hideAll(dt){
for(var i=1; i<=33;i++){
var tabdata = "tab"+i+"_data";
if (document.getElementById(tabdata)) {
document.getElementById(tabdata).style.display='none';
}
}
if(dt) {
document.getElementById(dt).style.display='block';
}
}

And even if this fixes the issue, make a stop by the validator and fix all of your code, whether the issues seem relevant or not (currently 92 Errors, 5 warnings). Just because a markup error isn't causing a noticeable problem now doesn't mean that it won't screw something up later.

bazz
11-09-2009, 02:18 PM
you have an error in your table structure which is triggering many more errors.

look for this line:



<table width="100%" border="0" cellpadding="0" cellspacing="0">


see how the tag prior to it is a tr tag. replace the <tr> tag with <tr><td> and see what happens to the validator results.

bazz

lrubin28
11-09-2009, 04:52 PM
Sorry to be dense guys - I am not a developer. I usually just create new pages and stay away from scripts. But yesterday I used my ISPs editor because I was not at home where my copy of Expression Web is that I would normally use. I'm not sure why, but I think someone the mess started there.

I added the <td> to the leftNav.html file, but still nothing works....??

bazz
11-09-2009, 05:13 PM
get yourself a copy of firefox and download the web developer plug-in. it'll let you go directly from your web page to the validator and show you where the errors are.

If it were my choice, I would use the son of suckerfish drop down which doesn't need javascript but instead uses css and is therefore workable for clients which have javascript or scripting disabled.

bazz

lrubin28
11-09-2009, 05:58 PM
ok thanks! I do use Firefox - I will get the plug in.

I am having my ISP restore my files from the day before. I still don't totally understand why using their tool causes problems like this...I know there's an explanation, but they couldn't really tell me.

lrubin28
11-09-2009, 06:11 PM
ok, so the ISP may not be restoring my files....I apologize for sounding like a smart-a@#, but I need to get my menus working soon - without menus, my customers can't place orders. Is there a way to diagnose why its not working aside from the validator? I can't figure out from there what the specific issue is and I need to get my site working.
larry

Excavator
11-09-2009, 06:49 PM
Wow, that is unfortunate that you don't have a working backup.

I clicked around on your site and seem to be able to place an order but the menu does not work very reliably. Using FireFox to do that. IE8 is worse.

I think this may be beyond your ability to fix and you should think about hiring it out. Maybe it's a good excuse for a facelift to the whole site.

Once you get it running again, you should check with your isp about how to set up a reliable backup so you'll have a working version to go back to if anything else ever happens.

lrubin28
11-09-2009, 07:33 PM
Thanks.

Yes, unfortunate I wasn't smart enough to keep a copy...and yes, the problem IS the menus! That's what I think I said initially...my menus no longer work.

With all due respect, and I sincerely appreciate the fact that you've responded, I was hoping to find an actual answer other than 'run it through the validator' - I mean its a good tool to use, but its not much in the way of actual advice. Telling everyone to use the validator is not really sharing knowledge - again, no disrespect intended....
I'm not a developer, but what I have on my website is not rocket science...I should be able to fix it if someone is willing to share their insite about the actual problem. Sorry if my response seems flippant.

Rowsdower!
11-09-2009, 07:33 PM
Sorry to be dense guys - I am not a developer. I usually just create new pages and stay away from scripts. But yesterday I used my ISPs editor because I was not at home where my copy of Expression Web is that I would normally use. I'm not sure why, but I think someone the mess started there.

I added the <td> to the leftNav.html file, but still nothing works....??

What specifically did you do with the editor?

Have you tried my suggestion yet?

lrubin28
11-09-2009, 07:42 PM
I changed some of the pricing on my html pages. AND probably most importantly I went into the leftNav.html and was trying to add some new pages to my navigational menus. But I used my ISP's file manager, which now they tell me I shouldn't do because it creates some sort of conflict(? they couldn't explain it well). But now my sub menus won't work...like if you click on Kaleidoscope Kits for example, it should expand to show all the kits...

Rowsdower!
11-09-2009, 07:44 PM
Yes, I understand the intended functionality of the menu. I've reviewed your HTML and javascript and off-the-bat I don't see anything other than what I mentioned in my first post. So...did you try what I suggested earlier?

lrubin28
11-09-2009, 07:45 PM
Where should I put this code (again, sorry - I am obviously not a developer!!). And from now on you can bet I will back up files....!

Larry

Rowsdower!
11-09-2009, 07:51 PM
You would need to use a text editor to open up your "tab.js" file (located in your "scripts" folder). Once you have the file open you would be replacing what you currently have toward the end of the file:


function hideAll(dt){
for(var i=1; i<=33;i++){
var tabdata = "tab"+i+"_data";
document.getElementById(tabdata).style.display='none';
}
//document.getElementById("tab1_data").style.display='none';
/*document.getElementById("tab2_data").style.display='none';
document.getElementById("tab3_data").style.display='none';
document.getElementById("tab4_data").style.display='none';
document.getElementById("tab5_data").style.display='none';
document.getElementById("tab6_data").style.display='none';
document.getElementById("tab7_data").style.display='none';
document.getElementById("tab8_data").style.display='none';
document.getElementById("tab9_data").style.display='none';
document.getElementById("tab10_data").style.display='none';
document.getElementById("tab11_data").style.display='none';
document.getElementById("tab12_data").style.display='none';
document.getElementById("tab13_data").style.display='none';
document.getElementById("tab14_data").style.display='none';
document.getElementById("tab15_data").style.display='none';
document.getElementById("tab16_data").style.display='none';
document.getElementById("tab17_data").style.display='none';
document.getElementById("tab18_data").style.display='none';
document.getElementById("tab19_data").style.display='none';
document.getElementById("tab20_data").style.display='none';
document.getElementById("tab21_data").style.display='none';
document.getElementById("tab22_data").style.display='none';
document.getElementById("tab23_data").style.display='none';
document.getElementById("tab24_data").style.display='none'; */

if(dt)
document.getElementById(dt).style.display='block';
}

With the code I posted before. Then you save the javascript file. If you did this with a web-based text editor from your host then you should be finished. If you downloaded the file then opened, edited, and saved it locally you will need to upload your changed file back to the server.

lrubin28
11-09-2009, 10:00 PM
Yes, I tried - here is what the 'tab.js' looks like now...Did I miss something?

var last_tab = 'tab1';

function show(layerName) {
//alert(document.getElementById(layerName).style.display);
document.getElementById(layerName).style.display = 'block';
}

function hide(layerName) {
document.getElementById(layerName).style.display = 'none';
}
function show_next(tab_name) {
document.getElementById(last_tab).className = 'tab';
var curr = document.getElementById(tab_name);
curr.className='tab_hover';
//hide(last_tab+'_data');
if(document.getElementById(tab_name+'_data').style.display == 'block'){
document.getElementById(tab_name+'_data').style.display = 'none';
curr.className='tab';
}
else{
hideAll(tab_name+'_data');
//document.getElementById(tab_name+'_data').style.display = 'block';
curr.className='tab_hover';
}
//hideAll();
//show(tab_name+'_data');
last_tab=tab_name;
}
function hideAll(dt){
for(var i=1; i<=33;i++){
var tabdata = "tab"+i+"_data";
if (document.getElementById(tabdata)) {
document.getElementById(tabdata).style.display='none';
}
}
if(dt) {
document.getElementById(dt).style.display='block';
}
}


What specifically did you do with the editor?

Have you tried my suggestion yet?

Rowsdower!
11-09-2009, 10:29 PM
Yes, I tried - here is what the 'tab.js' looks like now...Did I miss something?


var last_tab = 'tab1';

function show(layerName) {
//alert(document.getElementById(layerName).style.display);
document.getElementById(layerName).style.display = 'block';
}

function hide(layerName) {
document.getElementById(layerName).style.display = 'none';
}
function show_next(tab_name) {
document.getElementById(last_tab).className = 'tab';
var curr = document.getElementById(tab_name);
curr.className='tab_hover';
//hide(last_tab+'_data');
if(document.getElementById(tab_name+'_data').style.display == 'block'){
document.getElementById(tab_name+'_data').style.display = 'none';
curr.className='tab';
}
else{
hideAll(tab_name+'_data');
//document.getElementById(tab_name+'_data').style.display = 'block';
curr.className='tab_hover';
}
//hideAll();
//show(tab_name+'_data');
last_tab=tab_name;
}
function hideAll(dt){
for(var i=1; i<=33;i++){
var tabdata = "tab"+i+"_data";
if (document.getElementById(tabdata)) {
document.getElementById(tabdata).style.display='none';
}
}
if(dt) {
document.getElementById(dt).style.display='block';
}
}

Nope, that's all you needed. The website is working in FF3 and IE7 for me right now. Your little boxes that trigger the javascript are hard to isolate and use, but that might have always been that way. Anyway, the menu is now at least expanding and contracting as it ought to.

To fix the problems that remain, if any, you will need to validate your markup and possibly start tweaking some CSS. The javascript is now functioning properly as far as I can see.

lrubin28
11-09-2009, 10:57 PM
Wow!!! I owe you a huge, huge, huge thanks!!! Is there anything you can explain to me about what was causing it? And thank you, thank you, thank you...if you ever need any craft supplies (sorry, but that's what I sell!) let me know!!

Larry

Rowsdower!
11-09-2009, 11:19 PM
Your problem had to do with the "for" loop in your javascript. You were setting the loop to run 33 times (because you started out on the number 1 and on the 34th time through this loop the variable "i" will no longer be less than or equal to 33):


function hideAll(dt){
for(var i=1; i<=33;i++){
var tabdata = "tab"+i+"_data";
if (document.getElementById(tabdata)) {
document.getElementById(tabdata).style.display='none';
}
}
if(dt) {
document.getElementById(dt).style.display='block';
}
}

The problem was that you didn't have at least 33 tab[x]_data elements to cycle through (more like 29 or so) so the loop was attempting to set the display to "none" for non-existent elements which brought the whole thing crashing down. Once we made sure each element existed BEFORE trying to change its style we were in the clear.

Now, as a side note, if in the future you have more than 33 menu sections you will have to remember to increase the number in this location to match, but I doubt that will be an issue too soon.

Let me know if you have any more questions about this issue.

lrubin28
11-10-2009, 12:08 AM
Well thanks again - I do appreciate the time. I have no idea why this would have worked for so long and then suddenly stopped...but I'll add it to the list....thanks!

Larry



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum