+ 5

innerHtml isn't working for me

I'm trying to use innerHTML to change content to another is but when I click the tabs buttons I've set, nothing happens and the text stays the same https://code.sololearn.com/WPMNdUMnUJ0y/?ref=app

13th Apr 2018, 11:57 AM
Babydoll Scripts
Babydoll Scripts - avatar
12 Respostas
+ 3
Mike Choy Will this help me get my Website "Vulnerabilities" and "Program Exploits" buttons to work?
13th Apr 2018, 2:28 PM
Babydoll Scripts
Babydoll Scripts - avatar
+ 2
Mike Choy I don't think the code I used for my "next" button affects my problem with my nav buttons not working.
13th Apr 2018, 2:29 PM
Babydoll Scripts
Babydoll Scripts - avatar
+ 2
Mike Choy But for some reason the next button doesn't work anymore. It was fine yesterday.
13th Apr 2018, 2:45 PM
Babydoll Scripts
Babydoll Scripts - avatar
+ 2
Okay. You say, take the declaring elements outside of the window onload? I'll try. And I really hope the next button still works because it just stopped working for me.
13th Apr 2018, 2:51 PM
Babydoll Scripts
Babydoll Scripts - avatar
+ 2
Mike Choy I made a smaller version of the thing I'm trying to do and not even the test subject is working. When I click the websec button nothing changes. 😓
13th Apr 2018, 3:14 PM
Babydoll Scripts
Babydoll Scripts - avatar
+ 2
I'm just getting super frustrated
13th Apr 2018, 3:38 PM
Babydoll Scripts
Babydoll Scripts - avatar
+ 2
Thanks. I will look over it. While you were doing I remade the site with the buttons working but for some reason it tells me my next button doesn't have a function but it does.
13th Apr 2018, 6:46 PM
Babydoll Scripts
Babydoll Scripts - avatar
+ 1
Your Next button works for me. Have a crack at fixing the navs, if you get stuck I am happy to help you
13th Apr 2018, 2:49 PM
Mike Choy
Mike Choy - avatar
0
Hi CK You have declared all of your variables inside the window.onload function. This means that once window .onload has executed those variables get garbage collected. eg var intro=document.getElementById("intro") var SQL=document.getElementById("SQL"); var XSS=document.getElementById("Xss"); var BA=document.getElementById("BA"); var next=document.getElementById("next"); You need to move them into the global scope but set them inside window.onload =================like this===================== var intro, SQL, XSS, BA, next; window.onload=function(){ //tabs intro=document.getElementById("intro") SQL=document.getElementById("SQL"); XSS=document.getElementById("Xss"); BA=document.getElementById("BA"); next=document.getElementById("next"); ........... } Also declare your onClick handlers outside of windows.onload as well have a crack and see how you get on
13th Apr 2018, 2:13 PM
Mike Choy
Mike Choy - avatar
0
Give me moment and I will fix for you. There is no need to us java script for the links at the moment. Also you have multiple ids with the same names in your HMTL.
13th Apr 2018, 3:50 PM
Mike Choy
Mike Choy - avatar
0
Hi CB Here is working site for you , with no JavaScript!! https://code.sololearn.com/WAb3ZN30bYik/#html If you would like to see a JavaScript version I can do this also...... but may take some time. Good luck on adding your own content, I hope it is self explanatory
13th Apr 2018, 6:42 PM
Mike Choy
Mike Choy - avatar
0
OK good luck
13th Apr 2018, 7:05 PM
Mike Choy
Mike Choy - avatar