leonidassavvides
01-25-2009, 10:24 PM
a drop down menu html field how to limit it's size to eg 15 characters [HORIZONTALLY] ? Vertically be size="1" ...
Snookerman
01-25-2009, 10:31 PM
This might be helpful:
http://www.webmasterworld.com/html/3018783.htm (http://www.webmasterworld.com/html/3018783.htm)
Good luck!
Or if your using PHP:
$selects = array('Dogs', 'Cats', 'Tigers', 'Hippopotamus');
function select($array, $name, $limit = 5, $etc = true, $shorten_val = false){ //select( array_name , select_name, [limit], [display: ... after cutted], [shorten the value of the option])
$select = "<select name='{$name}'>\n";
foreach($array as $value){
$display_val = strlen($value) > $limit ? substr($value, 0, $limit).($etc ? "..." : "") : $value;
if($shorten_val){ $value = $display_val; }
$select .= "<option name='{$value}'>{$display_val}</option>\n";
}
$select .= "</select>\n";
return $select;
}
echo select($selects, 'type', 5, true, false);
Tell me if you need a commented version.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.