</html> <script type="text/javascript"> $(".droparrow").click(function(e){ var quest = $(this).parent(); var questwidth = parseInt(quest.width()); var questheight = quest.height(); var left = quest.offset().left; var top = parseInt(quest.offset().top)+parseInt(questheight)+4; var attrs = quest.attr("quest"); var selectsd = $('.chooseItems[answer='+attrs+']'); var selectsdHeight = selectsd.height(); if((top+selectsdHeight)>$(window).height()){ top = top - selectsdHeight - questheight-7; } if($(selectsd).is(":visible")){ $(selectsd).hide(); }else{ $(selectsd).css({"left":left+"px","top":top+"px","width":questwidth+"px"}).show(); } }); $(".dropdiv").click(function(e){ var quest = $(this).parent(); var questwidth = parseInt(quest.width()); var questheight = quest.height(); var left = quest.offset().left; var top = parseInt(quest.offset().top)+parseInt(questheight)+4; var attrs = quest.attr("quest"); var selectsd = $('.chooseItems[answer='+attrs+']'); var selectsdHeight = selectsd.height(); if((top+selectsdHeight)>$(window).height()){ top = top - selectsdHeight - questheight-7; } if($(selectsd).is(":visible")){ $(selectsd).hide(); }else{ $(selectsd).css({"left":left+"px","top":top+"px","width":questwidth+"px"}).show(); } }); $(".chooseItem").click(function(e){ var divhtml = $(this); var displayMember,valueMember; displayMember = divhtml.attr("displayMember"); valueMember = divhtml.attr("valueMember"); var attrs =$(this).parent().attr("answer"); var parent = $("#"+attrs); var olddisplayMember,oldvalueMember; olddisplayMember = parent.attr("displayMember"); oldvalueMember = parent.attr("valueMember"); if(olddisplayMember !=displayMember){ parent.attr("displayMember",displayMember); parent.attr("valueMember",valueMember); parent.html(valueMember); parent.change(); }