Jump to content

Question about HTML, and why this doesn't work...

I've been working on my school's website and I've ran into an issue with some html... I've been trying to intigrate hide/show buttons. I've got them to work, but I want a simple way to keep one open when the page loads... I've had way too many issues with this. Please help.

<center>    <title>Warriors VS Hampton</title>    <style type="text/css">#ex1{border:10px solid maroon;}body,input    {    font-family:"Trebuchet ms",arial;font-size:0.9em;    color:#333;    }.spoiler    {    border:1px solid #ddd;    padding:3px;    }.spoiler .inner    {    border:1px solid #eee;    padding:3px;margin:3px;    }    </style>    <script type="text/javascript">function showSpoiler(obj)    {    var inner = obj.parentNode.getElementsByTagName("div")[0];    if (inner.style.display == "none")        inner.style.display = "";    else        inner.style.display = "none";    }function click()        {myElement.click();}    </script><div id="ex1"><font size=6><font color="maroon">Warriors VS Hampton</font></font><click()><div class="spoiler">    <input type="button" onclick="showSpoiler(this);" value="Show/Hide" />    <div class="inner" style="display:none;">    <iframe width="640" height="360" src="https://www.youtube.com/embed/----------" frameborder="0" allowfullscreen></iframe></div>    </div></div></center>

Come fold while not gaming! http://linustechtips.com/main/forum/37-foldinghome-boinc-and-coin-mining/

Gaming Rig: i7-9700k 5GHz all core, GTX 1070, 16GB TridentZ, Buncha ssds...

Stream Machine: R7 1700, GTX 660 (lol), 16GB Corsair Somethingoranother, 120 GB SSD i've had since 2012. 

Mobile Workstation: MSI-ALPHA :R7 3750H, RX 5500M, 16GB of some ram, 500GB SSD.

 

 

 

Link to comment
https://linustechtips.com/topic/57580-question-about-html-and-why-this-doesnt-work/
Share on other sites

Link to post
Share on other sites

You need to add:

<!DOCTYPE html> on the top line

<html>

 

(Code here)

 

</html>

All of the code works without that... just when I try to make it "Fake" click

Come fold while not gaming! http://linustechtips.com/main/forum/37-foldinghome-boinc-and-coin-mining/

Gaming Rig: i7-9700k 5GHz all core, GTX 1070, 16GB TridentZ, Buncha ssds...

Stream Machine: R7 1700, GTX 660 (lol), 16GB Corsair Somethingoranother, 120 GB SSD i've had since 2012. 

Mobile Workstation: MSI-ALPHA :R7 3750H, RX 5500M, 16GB of some ram, 500GB SSD.

 

 

 

Link to post
Share on other sites

All of the code works without that... just when I try to make it "Fake" click

 

Ahh working on it :D

 

Here:

<!DOCTYPE html> <html>  <center>   <title>Warriors VS Hampton</title>   <style type="text/css">   #ex1   {    border:10px solid maroon;   }    body,input   {    font-family:"Trebuchet ms",arial;font-size:0.9em;    color:#333;   }    .spoiler   {    border:1px solid #ddd;    padding:3px;   }    .spoiler .inner   {    border:1px solid #eee;    padding:3px;margin:3px;   }   </style>   <script type="text/javascript">   function showSpoiler(obj)   {   var inner = obj.parentNode.getElementsByTagName("div")[0];   if (inner.style.display == "none")    inner.style.display = "";   else    inner.style.display = "none";   }   </script>   <div id="ex1">   <font size=6><font color="maroon">Warriors VS Hampton</font></font>   <!---   THIS IS NOT HOW CALL JAVASCRIPT FUNCTION!!!   <click()>   --->      <div class="spoiler">    <input id="trigger" type="button" onclick="showSpoiler(this);" value="Show/Hide" />     <div class="inner" style="display:none;">         <iframe width="640" height="360" src="https://www.youtube.com/embed/----------" frameborder="0" allowfullscreen></iframe>     </div>   </div>      <!---   You have to place the script to change the element after the element   --->   <script type="text/javascript"> document.getElementById("trigger").click();   </script>  </div> </center></html>

\

Link to post
Share on other sites

 

Ahh working on it :D

 

Here:

<!DOCTYPE html> <html>  <center>   <title>Warriors VS Hampton</title>   <style type="text/css">   #ex1   {    border:10px solid maroon;   }    body,input   {    font-family:"Trebuchet ms",arial;font-size:0.9em;    color:#333;   }    .spoiler   {    border:1px solid #ddd;    padding:3px;   }    .spoiler .inner   {    border:1px solid #eee;    padding:3px;margin:3px;   }   </style>   <script type="text/javascript">   function showSpoiler(obj)   {   var inner = obj.parentNode.getElementsByTagName("div")[0];   if (inner.style.display == "none")    inner.style.display = "";   else    inner.style.display = "none";   }   </script>   <div id="ex1">   <font size=6><font color="maroon">Warriors VS Hampton</font></font>   <!---   THIS IS NOT HOW CALL JAVASCRIPT FUNCTION!!!   <click()>   --->      <div class="spoiler">    <input id="trigger" type="button" onclick="showSpoiler(this);" value="Show/Hide" />     <div class="inner" style="display:none;">         <iframe width="640" height="360" src="https://www.youtube.com/embed/----------" frameborder="0" allowfullscreen></iframe>     </div>   </div>      <!---   You have to place the script to change the element after the element   --->   <script type="text/javascript"> document.getElementById("trigger").click();   </script>  </div> </center></html>

Thanks... I ned to learn HTML and javascript better...  Tried a few other sites for help... but nothing worked :P 

Come fold while not gaming! http://linustechtips.com/main/forum/37-foldinghome-boinc-and-coin-mining/

Gaming Rig: i7-9700k 5GHz all core, GTX 1070, 16GB TridentZ, Buncha ssds...

Stream Machine: R7 1700, GTX 660 (lol), 16GB Corsair Somethingoranother, 120 GB SSD i've had since 2012. 

Mobile Workstation: MSI-ALPHA :R7 3750H, RX 5500M, 16GB of some ram, 500GB SSD.

 

 

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×