我正在制作一个XHTML页面,我正在使用php来生成它。所以,现在我正在生成这样的组合框:
<select id="Indexer_Backend_select" size="1" onchange="changeHidBySelect('all_id')">
<option value="nr1">nr1</option>
<option value="nr2">nr2</option>
<option value="nr3" selected="selected">nr3</option>
</select>
所以,现在,在某些情况下,它正在发挥作用,而在某些情况下,只有最顶级的选择。
为什么这样?我严重受阻,所以我根本不知道怎么回事......
请求帮助
编辑:
- 我正在使用Firefox
- 我只是到处写这个,它是由PHP函数生成的,如下所示:
function createOptions($defaultvalue,$curr_path,$default_important,$only_modules) {
###############################################################################################
## String createOptions($defaultvalue string, $curr_path string, $default_important boolean, ##
## $only_modules boolean); ##
## ##
## This function returns all the Modules which can be selected in every workflow. ##
## The Return value is a string (the HTML-Code for the <select>-Wheel) ##
## ##
## $defaultvalue describes the preselected value. If none is set, the toppest (alphabetic ##
## order) is selected. For more, read param $default_important... ##
## ##
## $curr_path describes the path, on which the select's ID is based. ##
## ##
## $default_important describes, if it is important to recognize, if no default-value was ##
## given. If true, every time, no default-value was given, a little star is displayed ##
## next to the <select>. If false, this won't be displayed. ##
## ##
## $only_modules says, if the complete select tag or only all the <option>-Entrys should be ##
## returned. So, if set to true, only a list of <option>-Tags will be returned. ##
###############################################################################################
//Get global var $config... In there are the names for the options
global $config;
//Calling Global Array $config...
$options = $config["Indexer"]["Modules"]; //In here are the diffrent options
//Now creating options wheel...
$options_wheel = "";
if (!$only_modules) {
$options_wheel = "<select id=\"" . $curr_path . "_select\" size=\"1\" onchange=\"changeHidBySelect('" . $curr_path . "')\">";
}
$default_set = 0;
foreach ($options as $key => $value) {
$options_wheel .= "<option value=\"" . $options[$key]["Class"] . "\"";
if ($options[$key]["Class"] == $defaultvalue) { //in $options[$key]["Class"] are the values saved, e.g. "nr2"
$options_wheel .= " selected=\"selected\"";
$default_set = 1;
}
$options_wheel .= ">" . $options[$key]["Class"] . "<";
$options_wheel .= ($only_modules ? "\\" : "");
$options_wheel .= "/option>";
}
if (!$only_modules) {
$options_wheel = $options_wheel . "
</select><input type=\"hidden\" id=\"" . $curr_path . "_hidvalue\" name=\"" . $curr_path . "_hidvalue\" value=\"" . $defaultvalue . "\" />
";
}
if (($default_set == 0)&&($default_important == true)) {
$options_wheel .= "*";
}
return $options_wheel;
}
如果我现在调用此函数,我会这样称呼它:
echo createOptions($value4,$options_path,true,false);
$ value4是默认值,对于上面的示例,这将是“nr1”
所以,如果我现在用firebug或源代码看代码,有时会选择=“selected”,但是在其他情况下有一个根本不起作用,并显示第一个元素。 / p>
答案 0 :(得分:0)
那么伙计们,另一个问题在发布后一小时内自行解决了。我刚刚找到原因:
我在显示一个JS函数后调用,该函数使用select中的div操作此div旁边的div,它似乎以某种方式改变它。所以,但是现在如果我禁用了这个功能,那就完美了。所以我现在编辑这个函数;)thx求助