开发者

How to display title on html dropdown items for non-javascript browsers?

开发者 https://www.devze.com 2023-03-16 11:58 出处:网络
I am using ASP.Net MVC 2.0 with C#. I have a html dropdown control on my page which may contain items with longer text. The page design does not allow me to increase the drop down width so that I can

I am using ASP.Net MVC 2.0 with C#.

I have a html dropdown control on my page which may contain items with longer text. The page design does not allow me to increase the drop down width so that I can display entire text for each item. To overcome this, I am trying to display a title on mouse over of each item so that use can see the item text. This is achievable using javasctipt and I am happy with the solution. But what if the client has disabled javascript on his browser? Is there any way we can display title for each drop down item without depending on javascript? May be using the "title" attrbute of option or something simillar? I am targeting my code to work for IE8 clients.

Following is my current implementation. I have called a javascript function on mousemove. This loops through drop down options and assigns the selected value to the title attribute of selected option.

<%: Html.DropDownListFo开发者_高级运维r(model => model.SelectedTeamId, new SelectList((IEnumerable)""), "Please Select", new { @class = "wid140", id = "QueryTeam", onmousemove ="ShowSelectedText(this);"})%>
0

精彩评论

暂无评论...
验证码 换一张
取 消