Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
using the SELECTED attribute of an option
Old 07-06-2005, 09:37 AM using the SELECTED attribute of an option
bez
bez's Avatar
Skilled Talker

Posts: 53
Trades: 0
I have a PHP script that needs to set the default 'SELECTED' option of a select box.

This was very easy before I started thinking in terms in XHTML and web standards, i could just stick SELECTED in the appropriate OPTION element. But know im thinking this isnt the best way to go.

Would the 'default selected option' be classed as part of a page's structure (whereby it can be embedded in the XHTML) or part of its behaviour (whereby we would set it using JS), or is it even part of a page's display (set it in CSS). I think you could argue that the default selected element could be any one of these.

Ive tried putting 'selected' in the element i want and the page does not verify on w3c.org.

So... which is the 'correct' way to go, how do i do this?

Cheers for feedback
bez is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-06-2005, 11:02 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Just writing the word 'selected' as an attribute is called short-hand. Some doctypes don't allow shorthand attributes - you have to write them in full, such as:

selected="selected"

That should validate.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 07-07-2005, 07:39 AM
bez
bez's Avatar
Skilled Talker

Posts: 53
Trades: 0
that works, cheers M
bez is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to using the SELECTED attribute of an option
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17806 seconds with 12 queries