Using Javascript to sort table properly? - javascript

I've been working on this website on my computer for the past several weeks, but have had it a point that I just can't figure something out with my table sorting. The site itself runs off PHP but I've duplicated the HTML output to make it easier for you guys to help me diagnose what the problem is.
Here's a link to the Working Page: http://privateservercloud.com/working.htm
Here's a link to the Not Working Page: http://privateservercloud.com/not-working.htm
If you go to the Working Page, you'll see that you can click on any of the headers of the table and it will sort them. However, if you go to the Not Working Page, you'll see that this doesn't happen.
I'm trying to figure out what's missing or coded incorrectly and causing this to happen. I've uploaded all of the HTML, CSS, and Javascript that's running this part of the site so you can see how it's all working and hopefully that'll make life a bit easier for anyone that can help.
So... does anyone see what I'm doing wrong or know what needs to be fixed?

I load the not-working example in Firefox with Firebug and get the following:
TypeError: document.getElementById(...) is null
...for(var e=0;e<menuids.length;e++){var t=document.getElementById(menuids[e]).getE...
in dropdown.js line 1.
The debugging tools really are your friends. If you don't want to use Firefox, you can do the same thing with the development tools in Chrome.
I find errors when I run rhe validator at http://validator.w3.org and a pile of CSS errors at http://jigsaw.w3.org/css-validator/
When things don't work right, validate the HTML, which at least mostly assures you have a valid DOM. Then validate the CSS and use the JavaScript console in your favorite browser's debugger.

Related

Why are pagination links not displaying on my site?

I was trying to fix the width of the images however, unexpectedly, the navigation pager below disappeared.(pages 1,2,3). I am new to CSS and have no idea what happened. I don't now how to fix this, the navigation codes are still present however I guess it cannot find any space to show up. Can you help?
Code:https://gist.github.com/anonymous/3704b07a027426208738
Website:https://www.alphabitrage.com
I went through your code until I counted about 50 coding errors.
So I ran the source code (from the GitHub link you provided) through the W3C Markup Validation Service, which found 565 coding errors.
This alone suggests multiple problems with your web page and potential difficulties ahead in terms of maintenance and troubleshooting.
However, I understand you're working with a template so recommending that you re-structure your code to be valid and semantically correct (which I would normally do) may not be feasible in this case.
Also, you mention in your comments that the code was working well until you made some adjustments to the widths of images. So I put the errors aside and continued searching for a possible problem.
Providing a link to another website with a working template was a good idea on your part. I was able to compare your code with the code from the other site.
I discovered that your code was missing the divs that render the HTML for the pagination links.
In particular:
<div class="blog-pager" id="blog-pager"></div>
... is completely missing from your code.
Your Site
Other Site
Once you restore that code block your pager should re-appear.

Diagnosing Perplexing CSS errors

My website that has been up for a month now without any problems.
This morning everything was normal until I opened up the developer tools in chrome and when the cache refreshed the website was discombobulated!
Opening the website in Firefox I was able to get an idea of what is going on, but still have no clue how to resolve it.
Opened the page in Firefox before refreshing the cache
Notice in the css log how there are no errors.
Refreshed the cache
None of the css is applied and as you can see lots of css related errors.
I went through all my css/script files and none of them have been changed in the past 24 hours.. They all seem to be the same files that have been working perfectly for the past month.
Can anyone give me an idea of what might be going on here? Is it a server issue? Appreciate any ideas/answers to help me get to the bottom of this.
Click on the arrow next to the CSS button in FF's browser tools and deselect warnings.
What you're seeing are warnings related to things like vendor related prefixes.
In general, if warnings are serious enough that action is required, they would be errors. In my opinion you can safely ignore them.
See here: Should FF Error Console "Warnings" be taken seriously if page is not "broken"?
Looks like your site has lots the correct paths to the stylesheets. Have you changed your head or xml recently?
Solved
Another developer updated our bootstrap files from 2.3.2 to the latest version of bootstrap.. And for some reason the modified dates for the files did not change on the server.
Anyway because this issue is so isolated and the question probably won't be of any help to anyone in the future i'll remove it.. But leave this solution up for a few hours just as a FYI to those who have answered/commented on the question.

How do I see error messages for JavaScript/JQuery code in IE?

I am new to javascript and have been working overnight to see how I can fix this error on IE: Here's the question I asked here yesterday: How to fix this jquery function to work in IE?
After spending more than 20 hours I still can't find out why it wouldn't render parts of my page properly.
At the very least I thought I could find a way to get the errors so I can fix them or do a separate javascript file just for IE, but no luck.
How do I see error messages for my script?
I used F12 to see the developer console but no help there, it won't even tell me what's wrong.
I am using IE 8 and 9.
I know that there could be many things wrong with this and I appreciate your patience in advance for helping me out. Thanks!
You have invalid HTML including many invisible characters within the head section which is also blocking the W3C HTML Validator from getting past the first few errors.
When I copied your source code into my text editor, I found a bunch of invalid invisible characters. Did you cut/paste your JavaScript from someplace like a web-page? The invisibles only appear in front of your custom written scripts in the <head> and nowhere else. This could certainly explain a lot, including the validation error about a misplaced </head> tag. Go back to your editor and delete the indentations on every single line within the entire <head></head> section, then re-indent each line from scratch.
I also see an invalid closing tag, </label6>.
Remove the invisible characters, fix the invalid HTML, and see what IE does.
Moving forward, get yourself a powerful text editor that will allow you to see invisible characters so you can delete them and properly indent as needed. Otherwise, I recommend re-typing your code rather than cutting & pasting.
For JavaScript errors, the best is to see the 'Console' tab for records.
If IE's one isn't showing anything, maybe you could try using FireBug Lite, adding the following script after <head> (YES, put it as first thing, so it loads first than anything else).
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
On side note, maybe isn't a JS problem and yes something about running code locally. IE has some policies that mostly block client-side code from running. (Remember those annoying ActiveX prompts?). Check Intranet configuration on Settings.

LinkButton sometimes requires two clicks

I have an ASP.NET 4.0 Web Forms app and I'm using jQuery to do most of the JavaScript. The problem I'm having is that some of the links sometimes require two clicks for them to do anything.
Seemingly this happens at random and I have been unsuccessful in reproducing the problem in any kind of repeatable fashion, also there don't seem to be any JavaScript errors, so that's probably not the issue.
I'm at a loss as to what might be causing the issue. What might it be?
Without a view of your Javascript, HTML or backend code, there's not much I can suggest as to what might be causing the problem.
However, if you have Firebug installed, you could use that to see what clicking the button is doing each time and go from there.
Also... what is it supposed to do? What does it do the first time? These are questions that will need answers before debug assistance can be provided

mouseover not working in ie7

Having problems in IE7.It does not show me the "mouse over- drop down".
This "mouse over" was working well till yesterday also works in FireFox.
There a table that displays all the current documents.When one does a mouse over on a given document,it displays a list of options in form of a dropdown.
Can it be corrected in IE settings etc?
I am not talking about the javascript here , only the user settings.I am strictly the end user in this case.Also i tried downloading IE8 and it stopped in between.Hence I checked the ActiveX settings in IE and it was enabled.
Kindly help.
Your question seems well-founded, but it's difficult to discern what the question is exactly. Could you please elaborate? Source code may also help.
If you'd like to go a more DIY route, try throwing your code at JSLint. It will magically surface errors you didn't see.
Sitecore generates a lot of temporary and debug code files. This could be the problem. I would try deleting all of the temp/debug files, and see if that helps. They are scattered throughout the site, so you have to hunt for the debug directories.
However, I do see a lot of WEIRD JavaScript things with SiteCore. Sometimes I will load the content editor, and it wont work because of JS errors. I clear my cache and refresh and it works fine. But nothing in the JavaScript should be changing, since it would be the scripts from the vendor. I don't go in and change JS. Maybe they are generating JS somewhere.

Categories