Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To 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
 
Old August 3rd, 2005, 08:41 AM
Authorized User
 
Join Date: Aug 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default New option("xxx", "xxx")

Does anyone know how to set the title attribute of an option box using the 'new Option("xxx", "xxx");' javascript code?

Cheers,

Matt
 
Old August 3rd, 2005, 09:00 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Matt,

Try...
Code:
var o = new Option("option text", "option value");
o.title = "my title";
HTH,

Chris

 
Old August 3rd, 2005, 09:09 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Chris is right but some browsers, IE notably, don't support the title attribute on options. Last time I needed this in an IE only environment I used window.createPopup to show a small window, fired by the onmouseover of the select element. This might not work if the user has popups disabled though.

--

Joe (Microsoft MVP - XML)
 
Old August 3rd, 2005, 09:42 AM
Authorized User
 
Join Date: Aug 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmm, this is the same option I decided on but couldn't seem to get it working, but then again I am using I.E.

Thanks for the help.






Similar Threads
Thread Thread Starter Forum Replies Last Post
App_Code class compiled twice? xxx exists in both bigluzer General .NET 5 January 5th, 2007 03:45 PM
xxx is not a member of 'Membership' bcr212 ASP.NET 2.0 Basics 7 June 29th, 2006 10:41 AM
App.xxx ONLY via API - Help ! Peppiniello Pro VB 6 1 December 23rd, 2004 04:38 PM
Http://localhost/xxx/xxx/xxx.aspx Question bekim BOOK: ASP.NET Website Programming Problem-Design-Solution 2 June 11th, 2004 09:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.