#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Right Here
    Posts
    8
    Rep Power
    0

    howto javascript inside a textarea?


    I have a javascript which provide a news feed of events. It is quite long and I am trying to put the script inside a textarea box so that ppl can scroll down to see all the news, therefore reduce the amount of space the javascript uses on the page.

    When I just insert the javascript into the textarea, the script itself is all that shows up.

    How do I insert the javascript so it function properly and show the news. Do I put the script into a html page and then insert the page into the textarea box?

    I know this must be a simple thing and I think I have see an example somewhere.

    Thanks
  2. #2
  3. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1099
    1. Use an IFrame
    2. Use
    Code:
    <div style="width:500px;height200px;overflow:scroll">
    <!-- results of javascript here -->
    </div>
    3. You can use a textarea, but probably easier to use one of the above.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Right Here
    Posts
    8
    Rep Power
    0

    you are right on the barrel


    thanks for quick response....

    the iframe works except for there are some large margins on each side of the main text area. I am importing a html page into the frame, placing the raw javascript produces nothing.

    The Div work in that it provides scroll bars, but it still takes as much room as the news feed wants.

    I like the iframes, is there any way to force the html page to use the full area of the iframe? is there a default margin inside a Iframe?

    Thanks
  6. #4
  7. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1099
    I don't think there's a margin inside the iFrame, rather a margin created by the HTML in the iFrame's source. You'll need to look at the HTML source of the iFrame's source (as specified by the src= attribute.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Right Here
    Posts
    8
    Rep Power
    0

    Got it perfect!


    Ya more digging and I found, lots of the contorl is brought into the iframe from the page being imported since iframes are transperant.

    Fixed my width on the iframe and bingo, perfect with tired and error.


    Some day you will be richly rewarded in Heaven!


IMN logo majestic logo threadwatch logo seochat tools logo