SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Array of Paragraphs

    I need help to understand and to show/hide several paragraphs when the user clicks next and then the reverse when the user clicks prev.

    Can anyone help me? :S

  2. #2
    SitePoint Zealot Amit Yaron's Avatar
    Join Date
    Jan 2011
    Location
    Hod Haharon, Israel
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can create elements using "document.createElement("p");", as follows:
    Code:
    p=document.createElement("p");
    If you have created a paragraph element using "createElement", you can add content to it either by the element's method "innerHTML" or creating a text node and appending it:
    Example1:
    Code:
    p.innerHTML("<b>Example bold text.</b>");
    Example2:
    Code:
    myTextNode=document.createTextNode("My text");
    p.appendChild(myTextNode);
    To append 'p' to an array named 'a' use:
    Code:
    a[]=p


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •