473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

scroll select

If i press the button "MOVE UP", it will go to the top of the select
box.
If i press the button "MOVE DOWN", it will go to the bottom of the
select box.

The selected values that the user select will still be selected, even
if i press up or down.

It works in firefox....but not IE ? coz the scrollTop does not work in
IE.....
Is there any other way ?

Here the source :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Untitled Document</title>
</head>

<script type="text/javascript">

var bw = new lib_bwcheck()
function lib_bwcheck()
{
this.ver = navigator.appVersion
this.agent = navigator.userAgent
this.dom = document.getElementById?1:0
this.opera5 = this.agent.indexOf("Opera 5")>-1
this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom &&
!this.opera5)?1:0;
this.ie6 = (this.ver.indexOf("MSIE 6")>-1 && this.dom &&
!this.opera5)?1:0;
this.ie4 = (document.all && !this.dom && !this.opera5)?1:0;
this.ie = this.ie4||this.ie5||this.ie6
this.mac = this.agent.indexOf("Mac")>-1
this.ns6 = (this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4 = (document.layers && !this.dom)?1:0;
this.bw = (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6
|| this.opera5)
return this;
}

function moveBar(id, pos)
{
lb = document.getElementById(id);
arr = getMultiple(lb);
if (bw.ie)
{ if (pos == "top")
{ lb.selectedIndex = 0;
}
else
{ lb.selectedIndex = lb.length - 1;
lb.selectedIndex = -1;
}
}
else
{ if (pos == "top")
lb.scrollTop = 0;
else
lb.scrollTop = 50;
}
}

function getMultiple(lb)
{
var keep_array = new Array();
for (var i=0;i<Number(lb.length);i++)
{ if (lb.options[i].selected == true)
{ keep_array.push(i);
}
}
return keep_array;
}

</script>

<body>
<table width="200" border="0">
<tr>
<td><select class="Textfield" size="5" name="se" id="se" multiple >
<option value=""></option>
<option value="3">Value1</option>
<option value="4">Value2</option>
<option value="1">Value3</option>
<option value="6">Value4</option>
<option value="2">Value5</option>
<option value="3">Value6</option>
<option value="4">Value7</option>
<option value="1">Value8</option>
<option value="6">Value9</option>
<option value="2">Value10</option>
<option value="3">Value11</option>
<option value="4">Value12</option>
<option value="1">Value13</option>
<option value="6">Value14</option>
<option value="2">Value15</option>
<option value="3">Value16</option>
<option value="4">Value17</option>
<option value="1">Value18</option>
<option value="6">Value19</option>
<option value="2">Value20</option>
<option value="3">Value21</option>
<option value="4">Value22</option>
</select>
</td>
<td>
<input type="button" name="click" value="MOVE UP"
onClick="moveBar('se', 'top')">
<input type="button" name="click" value="MOVE DOWN"
onClick="moveBar('se', 'bottom')"></td>
</tr>
</table>
</body>

Dec 20 '05 #1
4 5685
fidodido wrote:
If i press the button "MOVE UP", it will go to the top of the select
box.
If i press the button "MOVE DOWN", it will go to the bottom of the
select box.

The selected values that the user select will still be selected, even
if i press up or down.
AFAIK, the pronoun "I" is always spelled "I".
It works in firefox....but not IE ?
"Does not work" is a useless error description. [psf 4.11]

<URL:http://jibbering.com/faq/#FAQ4_43>
coz the scrollTop does not work in ^^^
That word is not in my dictionary either.
IE.....
Is there any other way ?

Here the source :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
This is not Valid HTML. <URL:http://validator.w3.org/>
<title>Untitled Document</title>
<URL:http://www.w3.org/QA/Tips/good-titles>
</head>

<script type="text/javascript">
The `script' element must be child of the `head' or the `body' element.
var bw = new lib_bwcheck()
function lib_bwcheck()
{
this.ver = navigator.appVersion
this.agent = navigator.userAgent
this.dom = document.getElementById?1:0
this.opera5 = this.agent.indexOf("Opera 5")>-1
this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom &&
!this.opera5)?1:0;
[...]
<URL:http://pointedears.de/scripts/test/whatami>
[...]
<body>
<table width="200" border="0">
<tr>
<td><select class="Textfield" size="5" name="se" id="se" multiple>
<option value=""></option>
<option value="3">Value1</option>
[...]
Example code would have sufficed.
</select>

PointedEars
Dec 20 '05 #2
Thomas 'PointedEars' Lahn said the following on 12/20/2005 12:49 PM:
fidodido wrote:

If i press the button "MOVE UP", it will go to the top of the select
box.
If i press the button "MOVE DOWN", it will go to the bottom of the
select box.

The selected values that the user select will still be selected, even
if i press up or down.

AFAIK, the pronoun "I" is always spelled "I".


You understand incorrectly. I have told you before, before you decide to
be pedantic about a language and it's intricacies, you should endeavor
to understand that language and its dialects.

But for the record, it is not misspelled. It is mis-capitalized. Huge
difference.
It works in firefox....but not IE ?

"Does not work" is a useless error description. [psf 4.11]

<URL:http://jibbering.com/faq/#FAQ4_43>


As is this entire reply from you.
coz the scrollTop does not work in


^^^
That word is not in my dictionary either.


So freaking what?
IE.....
Is there any other way ?

Here the source :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>

This is not Valid HTML. <URL:http://validator.w3.org/>


Again, So freaking what? It's irrelevant to the question.

<title>Untitled Document</title>

<URL:http://www.w3.org/QA/Tips/good-titles>


Again, So freaking what? It's irrelevant to the question.
</head>

<script type="text/javascript">

The `script' element must be child of the `head' or the `body' element.


And when browsers encounter that code, it will close the head and open
the body. But it's irrelevant. As is the rest of your reply. If you
can't help, then troll elsewhere.
var bw = new lib_bwcheck()
function lib_bwcheck()
{
this.ver = navigator.appVersion
this.agent = navigator.userAgent
this.dom = document.getElementById?1:0
this.opera5 = this.agent.indexOf("Opera 5")>-1
this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom &&
!this.opera5)?1:0;
[...]

<URL:http://pointedears.de/scripts/test/whatami>


You need to fix that site, it reports my information incorrectly.
[...]
<body>
<table width="200" border="0">
<tr>
<td><select class="Textfield" size="5" name="se" id="se" multiple>
<option value=""></option>
<option value="3">Value1</option>
[...]

Example code would have sufficed.


It was given if you had bothered to look at it. But that is to be
expected from you.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 20 '05 #3
fidodido wrote :
If i press the button "MOVE UP", it will go to the top of the select
box.
If you want a quality answer/solution to your particular issue, then
please post a quality message.
If i press the button "MOVE DOWN", it will go to the bottom of the
select box.

The selected values that the user select will still be selected, even
if i press up or down.

It works in firefox....but not IE ? coz the scrollTop does not work in
IE.....
Is there any other way ?

Here the source :

<html>
No doctype declaration.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Untitled Document</title>
</head>

<script type="text/javascript">

var bw = new lib_bwcheck()
function lib_bwcheck()
{
this.ver = navigator.appVersion
this.agent = navigator.userAgent
this.dom = document.getElementById?1:0
this.opera5 = this.agent.indexOf("Opera 5")>-1
this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom &&
!this.opera5)?1:0;
this.ie6 = (this.ver.indexOf("MSIE 6")>-1 && this.dom &&
!this.opera5)?1:0;
this.ie4 = (document.all && !this.dom && !this.opera5)?1:0;
this.ie = this.ie4||this.ie5||this.ie6
this.mac = this.agent.indexOf("Mac")>-1
this.ns6 = (this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4 = (document.layers && !this.dom)?1:0;
this.bw = (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6
|| this.opera5)
return this;
}

All of the above function is definitively not recommendable and not
good. There is now a wide consensus among experienced web developers
that browser detection based on user-agent string detection is
unreliable, wrong, difficult, tedious to manage.

A Strategy That Works: Object/Feature Detecting by comp.lang.javascript
newsgroup FAQ notes
http://jibbering.com/faq/faq_notes/n...tect.html#bdFD
Browser detection - No; Object detection - Yes by Peter-Paul Koch
http://www.quirksmode.org/js/support.html
Browser identification approach (aka "browser sniffing"): not best, not
reliable approach; Using Object/Feature detection approach: best and
overall most reliable
http://www.mozilla.org/docs/web-deve...l#BrowserIdent
function moveBar(id, pos)


[snipped]

Do not post long excerpts of code; best is to post an url showing the
problem and then ask a few questions. You will get assistance from this
newsgroup if you post the best helpful message (for readers wishing to
read your post and assist you).

Gérard
--
remove blah to email me
Dec 22 '05 #4
JRS: In article <41*************@uni-berlin.de>, dated Thu, 22 Dec 2005
16:43:03 local, seen in news:comp.lang.javascript, Gérard Talbot
<ne***********@gtalbot.org> posted :

Do not post long excerpts of code; best is to post an url showing the
problem and then ask a few questions. You will get assistance from this
newsgroup if you post the best helpful message (for readers wishing to
read your post and assist you).


No. Those with off-line newsreaders do not appreciate that approach.

Best is to simplify the problematic code until it is short enough to
post, checking that in the simplified form the problem still occurs.

Quite often, the solution will become obvious in the simplification.

Your cited approach is second best.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Dec 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Larry Morroni | last post by:
Hi, I am hitting an issue when using SCROLL CURSORS. -->My Setup: PostgreSQL 8.0.3 on Windows XP Pro SP2 -->My Test Function: CREATE OR REPLACE FUNCTION TestFunction () RETURNS varchar(50)...
1
by: steve farris | last post by:
I have a scroll box that allows multiple selections. Something like: <select size=4 multiple name=xyz> Now, when i show the form i default select one of the entries. If the selected entry is...
2
by: GrantS | last post by:
I am trying to convert the VB.Net code example povided by http://authors.aspalliance.com/JimRoss/Articles/MaintainScrollPos.aspx into C# (ASP.Net)without success. No errors are thrown in the VB...
8
by: rodchar | last post by:
hey all, can someone please tell me if you can disable the scroll button for a dropdownlist. For example, when you select an item in a dropdownlist and it still has focus and you accidently hit...
0
by: Nathan Carroll | last post by:
I have the code below working fairly well. It is a little jumpy on movement at times. When repositioning scroll and navigating records. Any guidance on this? Enum ScrollAction As Integer...
0
by: Larry Morroni | last post by:
Hi, I am hitting an issue when using SCROLL CURSORS. -->My Setup: PostgreSQL 8.0.3 on Windows XP Pro SP2 -->My Test Function: CREATE OR REPLACE FUNCTION TestFunction () RETURNS varchar(50)...
3
by: Taras_96 | last post by:
Hi everyone, I've got a select box with multiple="yes" with fixed width. Unfortunately the content that goes into the box is too wide (and I can't make the box any bigger due to layout...
7
by: Lit | last post by:
Hi, How can I capture the vertical scroll bar position for a Listbox. I have a Listbox of 100 items + when I click on it I post back remove the item selected. After returning to the client...
4
by: Matthew Cox | last post by:
Hi, I've been searching the net all day today trying to figure out how one would accomplish what I originally thought would be a fairly straight forward and simple thing. The problem I'm trying...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.