• 0

how to make a scrollbar?


Question

What is the java code to make a vertical scrollbar (so you could scroll some parts of your webpage), something like this one where you have to enter the text to post here on neowin? I know you could find a lot of tutorials on the internet, but the problem is I don't know how it's called correctly & can't find it

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

k, let me see how I could explain it best

e g, this is my simplified source code

<TABLE WIDTH="100" BORDER="0" CELLSPACING="0" CELLPADDING="0">

<TR>

<TD WIDTH="50%">1</TD>

<TD WIDTH="50%">2</TD>

</TR>

</TABLE>

The frame with number 1 is just a frame, but I need that frame with number 2 has a vertical scrollbar in it.

Link to comment
Share on other sites

  • 0

Huh? You created a table with 2 cells - to have a scroll bar, you need something to scroll. IE a textarea, or frame, or an Iframe, etc..

Link to comment
Share on other sites

  • 0

No, he means like this:

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;&lt;br &gt;        &lt;title&gt;Test&lt;/title&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
        &lt;style type="text/css"&gt;&lt;!--
        table {
                border: thin solid black;
        }
        tbody {
                overflow: auto;
                height: 100px;
        }
        --&gt;&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;
&lt;t head&gt;
        &lt;tr&gt;&lt;td&gt;Title Data&lt;/td&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;this is my data, this is my data&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/body&gt;
 60;/html&gt;

Unfortunately, this tactic only works in Mozilla (and probably Opera), but it fails miserably in IE. You will have to make design adjustments if you want compatibility (i.e. use something other than tables), but the key to get this example working is to use the overflow property.

Read the CSS links in my sig for more CSS info, or more specifically, read this:

http://www.w3.org/TR/REC-CSS2/visufx.html

P.S. That code has some basic HTML bugs in it. This message board just isn't processing HTML code correctly :(

Link to comment
Share on other sites

  • 0
The input boxes on Neowin are just input boxes...

<textarea name="textarea" cols="3" rows="4">Default Text Here</textarea>

That what you want?

Yes something like that, but with regular text, text that you can't edit

Oogle

damn, I have only IE, so I can't use that :angry:

don't you have any easier solutions?

Link to comment
Share on other sites

  • 0

This works in IE and Mozilla.

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt; 0;br &gt; ? ? ? &lt;title&gt;Test&lt;/title&gt;
 ? ? ? &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
 ? ? ? &lt;style type="text/css"&gt;&lt;!--
 ? ? ? table {
 ? ? ? ? ? ? ? border: thin solid black;
 ? ? ? }
 ? ? ? tbody {
 ? ? ? ? ? ? ? overflow: auto;
 ? ? ? ? ? ? ? height: 100px;
 ? ? ? }
 ? ? ? --&gt;&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;
&lt;t head&gt;
 ? ? ? &lt;tr&gt;&lt;td&gt;Title Data&lt;/td&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
	&lt; td&gt;
	&lt;div id="testDiv" style="width:300px;height:150px;overflow:auto;text-align:justify"&gt;T he DIV and SPAN elements, in conjunction with the id and class attributes,
 ?offer a generic mechanism for adding structure to documents. These elements define
 ?content to be inline (SPAN) or block-level (DIV) but impose no other presentational
 ?idioms on the content. Thus, authors may use these elements in conjunction with style sheets,
 ?the lang attribute, etc., to tailor HTML to their own needs and tastes
	&lt;/div&gt;
	&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table &gt;
&lt;/body&gt;
&lt;/html&gt;

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.