 |
| Javascript General Javascript discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 2nd, 2004, 10:26 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
open single select object via javascript
hi all,
How shall I open a single select HTML object(drop down combo box) through a javascript function?
note that I've already tried codes below: document.getElementById("mySelectBox").click();
document.getElementById("mySelectBox").click;
document.getElementById("mySelectBox").focus();
document.getElementById("mySelectBox").focus;
document.getElementById("mySelectBox").dragDrop();
document.getElementById("mySelectBox").dragDrop;
....
Help me out!?
|
|

December 2nd, 2004, 10:24 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
|
|

December 3rd, 2004, 07:09 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
You can set the size and then reset it:
Code:
var oListbox = document.getElementById("mySelectBox");
oListbox.size = oListbox.options.length;
--
Joe ( Microsoft MVP - XML)
|
|

December 4th, 2004, 02:43 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks but changing the size will affect the alignment of other entities on the page. ain't there a better solution?
|
|

December 5th, 2004, 03:55 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hii nerssi,
Are you talking about how to make selected any items from the javascript function?If so then try this example
<script>
function setSelection(obj)
{
alert(obj.value)
obj1=document.getElementById("sel1")
obj1.selectedIndex=obj.value
}
</script>
<form name="test">
<input type=text name="mybox" onblur="setSelection(this)">
<select name="sel" id="sel1"><option value=1>1</option>
<option value=1>11</option>
<option value=1>111</option>
<option value=1>11111</option>
<option value=1>111111</option>
<option value=1>1111111</option>
<option value=1>11111112222222222222222</option>
</select>
</form>
Cheers :)
vinod
|
|

December 6th, 2004, 09:49 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
NOOOO!
I mean to open it!!
thanks anyway...
|
|

December 26th, 2005, 10:26 AM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Nerssi, you could find a solution for this topic?
I also need to open a select to show for the user the options that he forget to select...
If you have a solution or anything related, send me a mail (in my profile)
Thanks..
|
|

February 3rd, 2006, 12:06 PM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hello, anybody know? Nerssi, where are you?
|
|

February 27th, 2006, 03:59 PM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Nerssi is online? could you see this post?
|
|
 |