This is a little messy, but it works and should serve as an example as to how you could make this work. I use JQuery, so hopefully that isn't an issue.During the initialization:
map.graphics.enableMouseEvents();
dojo.connect(map.graphics, "onClick", function(evt) {
map.infoWindow.setContent("<span id='spanSelectPDF'></span><span><input type='button' value='Open PDF' onclick='openPDF();' /></span>");
var URLs = evt.graphic.attributes.PDFs.split(";"); // Assumes attribute's name is 'PDFs'
if (URLs.length > 1) { // More than 1 pdf, so use a select list...
var selectList = $("<select id='selectPDF' />");
selectList.append($("<option selected='selected'>Select PDF</option>"));
for (var i = 0; i < URLs.length; i++) {
var url = URLs;
selectList.append($("<option value='" + url + "'>" + url + "</option>"));
}
$("#spanSelectPDF").append(selectList);
} else { // One (or fewer) pdfs, just put the URL in the span to display
$("#spanSelectPDF").html(URLs[0]);
}
});
Then the code for "openPDF()":function openPDF() {
var url;
if ($("#selectPDF").length > 0) // Check if the select list exists
url = $("#selectPDF").find("option:selected").val(); // get the value of the selected option
else
url = $("#spanSelectPDF").html(); // otherwise use the html we stuck in the span as the link
if (url != "") // Check the url has a value, as our default option has no value (requires that the user make a selection)
window.open(url); // Open the link
}
Hope this helps.