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

  • SEARCH
  • Home
  • 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 6775819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:57:08+00:00 2026-05-26T15:57:08+00:00

Here ‘s the site. I contained the Caption button in a div and I’m

  • 0

Here‘s the site.

I contained the “Caption” button in a div and I’m trying to figure out how to position it relative to the image, just under it. So when I change the image, it positions itself just under the new image too. However, I can’t even get it to position relative to the image. Here’s the code:

<?php
    $username = $_GET['username'];
    session_start();
    $_SESSION['username'] = $username;

    //Database Information
    $dbhost = "";
    $dbname = "";
    $dbuser = "";
    $dbpass = "";

    //Connect to database
    mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
    mysql_select_db($dbname) or die(mysql_error());

    //Do the query
    $query = mysql_query("SELECT * FROM images ORDER BY idnum DESC LIMIT 5");

    //Generate an array of all images
    $images = array();
    while($image = mysql_fetch_array($query)) {
    //this adds each image to the images array
    $images[] = $image;
    $image['filename'] = $firstimage;
}
?>

<?php

    // Beginning attempt at a caption script.



?>

<html>
  <head>
   <title>Home - Site in Development</title>
   <link rel="stylesheet" type="text/css" href="styles.css"/>
   <script type="text/javascript">

     // Switches the url to view large image.

    function switchImageUrl(url, width, height) {
     var x = document.getElementById('caption_selection');
        x.style.display = 'none';

     document.getElementById('center_frame').style.backgroundImage = 'url' + '(' + url + ')';
        document.getElementById('center_frame').style.width = width;
        document.getElementById('center_frame').style.height = height;
    }

   </script>

    <script type="text/javascript">

     function selectionToggle() {
       var x = document.getElementById('caption_selection');
       if(x.style.display == 'block')
          x.style.display = 'none';
       else
          x.style.display = 'block';
          x.style.width = '75px';
          x.style.height = '75px';
          x.style.top = '0px';
          x.style.left = '0px';
    }

    </script>

    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
      <script>
      $(document).ready(function() {
        $("#caption_selection").draggable({
        containment : "#center_frame"
        });
        $("#caption_selection").resizable({
        containment : "#center_frame"
        });
      });
      </script>

  </head>
  <body onLoad="CalculateAllImageWidthes()">
   <div id='account_links'>
    <?php
    if ($_SESSION['username']) {
     echo "Welcome $username!";
    } else { ?>
     <a href='login.php'>Login</a> | <a href='register.php'>Register</a>
    <?php } ?>
   </div>

   <h1>Picture Captions</h1>
   <br/>
   <br/>
   <div id="left_bar">
    Submit a picture <a href="upload.php">here</a>.
   <hr/>
   <h2>Top Images</h2>
   <br/>

   <div id="front_pg_images">
    <?php foreach($images as $image) { ?>
     <a onClick="switchImageUrl('<?php echo $image['filename']; ?>', '<?php echo $image['width']; ?>', '<?php echo $image['height']; ?>')"><img src="<?php echo $image['filename'];?>" width="72px" height="58px" id="front_pg_thumbnail"/></a>
     <?php echo $image['name']." - by ".$image['submitter']; ?> <br/>
     <br/>
    <?php } ?>
  </div>

  </div>
   <div id="center_frame" style="width: <?php echo $image['width']; echo "px" ?>; height: <?php echo $image['height']; echo "px" ?>; background-image: url('<?php echo $image['filename'];?>')" >
   <div id="caption_selection" style="display:none">

   </div> 
   </div>
   <div id="toggle_select_container">
    <input type="button" id="toggle_select" onClick="selectionToggle()" value="Caption"/>
   </div>


  </body>
</html>
  • 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-05-26T15:57:09+00:00Added an answer on May 26, 2026 at 3:57 pm

    I’m not sure where it’s being set (probably styles.css), but change the positioning style for the ‘#center_frame’ element from absolute to relative. That appears to fix the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here is the problem I'm trying to solve for my game. I have this
Here is my HTML. Just a simple form: <form> Username: <input type=text id=username/> <br/>
here is the site : http://www.notrepanorama.com at the bottom left, i use a jquery
Here is my code (Say we have a single button on the page that
Here's the flow that I am trying to achieve: 1) User uploads an audio
Here is what I am trying to achieve in PHP: I have this string:
Here's what I'm trying to do... It's quite simple and obviously there must be
Here is my question. I am having this simple menu. <div id=menu> <ul> <li>
Here is binding: <Image Width=16 Height=16 Source={Binding SwitchForImage, Converter={StaticResource stringToImage}} HorizontalAlignment=Left> </Image> and here

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.