• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using dropdown box in JavaScript

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please tell me how to use Combo items as links which will open another window and display the appropriate page.
Here we have to use the function for the combo links to open another window....
[ August 09, 2006: Message edited by: Vicky Shah ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Call a function with the onchange attrib of the SELECT element. In that onchange event function, do a window.open call passing in parameters as appropriate for the new window.
 
Brijesh Shah
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gregg,

I did the same thing what you have suggested in the Select tag using the OnChange event and passed the parameters for my new Window using the window.open call.

function openwindow1()
{
MyWindow1=window.open("Comboimage/Comboimage1.html","","toolbar=yes,location=yes,"+
"directories=yes,status=yes,menubar=yes,scrollbar=yes,resizable=yes,width=475,height=475")
}//closing the function openwindow1()
function openwindow2()
{
MyWindow2=window.open("Comboimage/Comboimage2.html","","toolbar=yes,location=yes,"+
"directories=yes,status=yes,menubar=yes,scrollbar=yes,resizable=yes,width=475,height=475")
}//closing the function openwindow2()
function openwindow3()
{
MyWindow3=window.open("Comboimage/Comboimage3.html","","toolbar=yes,location=yes,"+
"directories=yes,status=yes,menubar=yes,scrollbar=yes,resizable=yes,width=475,height=475")
}

------------------------------------------------------------------------
<SELECT >
<OPTION></OPTION>
<OPTION NAME="windowform1" ONCHANGE="openwindow1()">Traffic</OPTION>
<OPTION NAME="windowform2" ONCHANGE="openwindow2()">Businessmen</OPTION>
<OPTION NAME="windowform3" ONCHANGE="openwindow3()">Tall Buildings</OPTION>
</SELECT>
 
Sheriff
Posts: 67745
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[Bear moves his sopabox into position]

Just for the record, there is no such thing as a "Combo box" in HTML. A <select> element is not a Combo Box. A Combo Box is a desktop UI element in which the user can either choose from a dropdown option or type their own value into the control. HTML does not have such a native control.

You can call it a select element, or you can call it a dropdown, but please do not call it a Combo Box.

I'll be quiet now.

[Bear steps down from the soapbox]
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Brijesh Shah
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Yuriy,
You suggested me to use the code below for the above isssue but its not working for my coding.

<select onchage="window.open(this.options[this.selectedIndex].value,'testWindow')"><option value="page1.html">page1</option><option value="page2.html">page2</option><option value="page3.html">page3</option></select>

Please can you suggest for my code how can I use the above for my coding?
My code is given above.
Thanks in addvance........
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<script>
function openwindow(url)
{
MyWindow1=window.open("Comboimage/Comboimage1.html","","toolbar=yes,location=yes,"+
"directories=yes,status=yes,menubar=yes,scrollbar=yes,resizable=yes,width=475,height=475")
}
</script>
<select onchange="openwindow(this.options[this.selectedIndex].value)">
<option value="Comboimage/Comboimage1.html">page1</option>
<option value="Comboimage/Comboimage2.html">page2</option>
<option value="Comboimage/Comboimage3.html">page3</option>
</select>
 
It's a tiny ad. At least, that's what she said.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic