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 6134265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:20:00+00:00 2026-05-23T17:20:00+00:00

soooo i have this function that prints one of 5 random texts ON an

  • 0

soooo i have this function that prints one of 5 random texts ON an image (in my case, a notepad, like writing on it.)

function getatext()
{
   var whichtext=get_random();

    var text=new Array(5)
     text[0]="text0";
     text[1]="text1";
     text[2]="text2";   
     text[3]="text3";
     text[4]="text4";

     document.getElementById("notepad").innerHTML +=
             '<p class="notepad">'+(text[whichtext])+'</p>';

Thing is, every time i have text printed, it is printed on top of another, instead of like a new entry, and pushing the others down the list.

I tried <li> tags but most examples and tuts i can stumble upon use them in simple html pages, not in javascript text writes which appear somewhat more difficult (at least to me).

Using '<p class="notepad">'+'<li>'+(text[whichtext])+'</li>'+'</p>'; got me the list appear, though it is not printed ON the image, but way off. I guess it completely ignores the <p> tag this way?

I even tried creating a ul.notepad inside my .css in case it mattered.. What am I doing wrong?

EDIT: included from .css .notepad, p.notepad and <content> where all this is taking place:

#content {
    border-left:1px solid #000;
    border-right:1px solid #000;
    background:#ffffff;
    margin-left: 24.9%;
    width:75%;
    min-height:0;
    position:relative;  

.notepad {
        position: relative;
        background-repeat:no-repeat;  
        background-attachment:fixed; 
        width: 300px;
}

p.notepad {
    font-family:"Lucida Handwriting";
    position: absolute;
    top: 90px; 
    left: 65px;   
}

EDIT 2: after inspecting the problem some more, I’ve found out that position: absolute; inside my p.notepad is probably causing all this. A random text is printed for the first time, then when the time for the second text to be printed comes, it takes the same coords from p.notepad and that is why it prints it ontop of the 1st text. But having the position: absolute is important, otherwise the text it isn’t printed ON my notepad image..

  • 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-23T17:20:01+00:00Added an answer on May 23, 2026 at 5:20 pm

    This is likely a CSS issue, not an HTML issue. The formatting of your HTML is likely overlapping. It is difficult without seeing the CSS.

    Here is an example of basically what you are doing, but working:

    http://jsbin.com/abemiv

    Use:
    http://jsbin.com/abemiv/edit

    to edit the source

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

Sidebar

Related Questions

BEFORE CHAOS I used to have this one... at the head part <script type=text/javascript>$(function()
Soooo, I am starting this new job soon where most of the code is
This is a question that is an extension of my previous Free 3 of
I have a piece of templated code that is never run, but is compiled.
I have tried so many things but I don't understand this sooo confusing. I
i have a little bit lame question, but it's time i have this finally
I have some HIGHLY sensitive data that I need to expose to Android and
Is there a way to get Eclipse to do something like this: It would
I have this textbox: <%= Html.TextBox(EffectiveDate, Model.EffectiveDate.HasValue ? Model.EffectiveDate.Value.ToString(dd-MMM-yyyy) : , new { @class
I have inherited a webforms application that was working and now is not. The

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.