Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8514285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:49:18+00:00 2026-06-11T04:49:18+00:00

having what I imagine is probably a simple problem. Although I’ve set alerts in

  • 0

having what I imagine is probably a simple problem. Although I’ve set alerts in my on click “toggle” function, they never appear. I presume the trouble is somehow with adding the event handlers, but I really don’t know. Any thoughts would be greatly appreciated! Many thanks.

index.html:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Men With Arms</title>
        <!--<link rel="stylesheet" type="text/css" href="style.css" />-->
        <script type="text/javascript" src="scripts.js"></script>
        <style type="text/css">
            body { margin: 0; padding: 0; background-color: #111; color: #FFF; text-align: center; font-family: "Helvetica Neue Light", Helvetica, sans-serif; }
            #yall { position: absolute; width: 100%; height: 100%; }
            #content { position: absolute; margin: -225px 0 0 -400px; padding: 0.15em; top: 50%; left: 50%; background-color: #FFF; }
            #front { margin: 0; padding: 0; width: 800px; height: 451px; background-color: #000; }
            #lloyd, #dad, #martha { width: 800px; height: 451px; display: none; border: 0; }
            h1 { margin: 0; padding: 0.25em 0 0 0; }
            ul { list-style-type: none; margin: 0; padding: 0.5em 0 0 0; }
            li { padding: 0 0 0 0.5em; display: inline; }
            a:link, a:active, a:visited { color: #FFF; text-decoration: none;  }
            a:hover { color: #FFF; text-decoration: none; border-bottom: 1px solid #FFF; }
            .bottom { position: absolute; left: 40.5%; bottom: .75em; font-size: 11px; padding: 5em 0 0 0; }
            .ltr { unicode-bidi: bidi-override; direction: rtl; }
            /*@font-face { font-family: "Helvetica Neue Light"; src: url('/font/HelveticaNeueDeskUI.ttc'); font-weight: 200; }*/
        </style>
    </head>
    <body>
        <div id="yall">
            <div id="content">
                <div id="front">
                        <h1>MEN WITH ARMS</h1>
                        <ul id="menu">
                            <li><a href="#">LLOYD</a></li>
                            <li><a href="#">DAD</a></li>
                            <li><a href="#">MARTHA</a></li>
                        </ul>
                        <span class="bottom">&copy; mothers favorite pictures 2012<br />
                            <span class="ltr">moc.smrahtiwnem&#64;mom</span>
                        </span>
                </div>
                <iframe id="lloyd" src="http://player.vimeo.com/video/28292168?title=0&amp;byline=0&amp;portrait=0&amp;color=e813c8"></iframe>
                <iframe id="dad" src="http://player.vimeo.com/video/28253343?title=0&amp;byline=0&amp;portrait=0&amp;color=e813c8"></iframe>
                <iframe id="martha" src="http://player.vimeo.com/video/28388076?title=0&amp;byline=0&amp;portrait=0&amp;color=FF7788"></iframe>
            </div>
        </div>
     </body>
 </html>

scripts.js:

function toggle(e) {
    alert('click!');
    alert(get_source_element(e).tagName);
    if (get_source_element(e).tagName=='a') {
        document.getElementById(get_source_element(e).innerHTML.toLowercase()).style.display='block';
        document.getElementById('front').style.display='none';
        return false;
    }
    else {
        alert('hide!');
        var frames = document.getElementById('content').getElementsByTagName('iframe');
        for (i = 0; i < frames.length; i++) {
            frames[i].style.display='none';
        }
        document.getElementById('front').style.display='block';
    }
}
// return event source
function get_source_element(e) {
    var targ;
    if (!e) e = window.event;
    if (e.target) targ = e.target;
    else if (e.srcElement) targ = e.srcElement;
    if (targ.nodeType == 3) // defeat Safari bug
        targ = targ.parentNode;
    return targ;
}
function load() {
    document.getElementById('yall').addEventListener('onclick', toggle, false);
    document.getElementById('content').addEventListener('onclick', toggle, false);
    var as = document.getElementById('menu').getElementsByTagName('a');
    for (i = 0; i < as.length; i++) {
        as[i].addEventListener('onclick', toggle, false);
    }
}
document.addEventListener('DOMContentLoaded', load, false);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:49:19+00:00Added an answer on June 11, 2026 at 4:49 am

    When calling addEventListener, you should drop the on prefix. So just click.

    Additionally, to allow support for browsers that use attachEvent, try this:

    var elem = document.getElementById('yall');
    (elem.attachEvent || elem.addEventListener)('click',toggle,false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having issues with what I can only imagine is a very simple
I'm having the following problem. Imagine my mySQL table looks like this: id range
Let's imagine that we are having cars table with such a simple structure... car_id
I'm having some trouble with finalizing my MySQL query. Imagine that i combine the
I am having trouble trying to get iterators for inner sub-containers. Basically imagine this
Having trouble with each function... Will try to explain by example... In my code,
Imagine having two list boxes on a form, where the choices in the second
This is probably a silly question, but I am having a hard time finding
i am currently having a problem, i guess a lot of people have run
Imagine having the following scenario: You need to create a system where the Back

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.