WordPress.org

Ready to get started?Download WordPress

Forums

List Administrators with css/javascript hover (1 post)

  1. baszer
    Member
    Posted 2 years ago #

    Hello,

    I am trying do something just a little out of my range. Hopefully it is very easy for one of you guys and with a little help I can solve it :)

    I have the following code to list my administrators, works fine:

    <ul>
    <?php
        $blogusers = get_users('blog_id=1&orderby=nicename&role=administrator');
        foreach ($blogusers as $user) {
            echo '<li>' . $user->display_name . '</a>' . '</li>';
        }
    ?>
    </ul>

    now I want to do the following. When a user hovers over an listed user there has to popup some information. For the popping up I have the following code (which works of course with a javascript, and I have this also working):

    <a
       onmouseover="ShowContent('popup'); return true;"
       onmouseout="HideContent('popup'); return true;"
       href="javascript:ShowContent('popup')">
    [show on mouseover, hide on mouseout]
    </a>
    <div id="popup">
    	Content goes here.
    </div>

    Now I want to combine the two. And the trouble starts here for me. Because the ' before and after the word popup destroys it. I was thinking something like the following code:

    <ul>
    <?php
        $blogusers = get_users('blog_id=1&orderby=nicename&role=administrator');
        foreach ($blogusers as $user) {
            echo '
    <li>' . '<a
       onmouseover="ShowContent('popup'); return true;"
       onmouseout="HideContent('popup'); return true;"
       href="javascript:ShowContent('popup')">' . $user->display_name . '</a> <div id="popup">
    	Content goes here.
    </div>' . '</li>
    ';
        }
    ?>
    </ul>

    but this is not allowed. Does somebody knows the answer?

Topic Closed

This topic has been closed to new replies.

About this Topic