function twitterPopup(evt){ var graphic = evt.graphic; var attr = graphic.attributes; var newDate = (attr.created_at).replace('+0000', 'UTC'); var content = ''; if (attr.profile_image_url) { content = '<a class="twImage" href="http://twitter.com/' + attr.from_user + '" target="_blank"><img class="shadow" src="' + attr.profile_image_url + '" width="48" height="48"></a>'; } content += '<p>' + replaceURLWithLinks(attr.text) + '</p>'; content += '<div class="clear"></div><ul class="iwContentList"><li><b>Location:</b> (' + attr.geo.coordinates + ')</li><li><b>Created:</b> ' + newDate + '</li></ul></div><br/>'; content += '<div align="center"> <input value="Add to Database" id = "add" type="button" onClick="addTwitterToDatabase(this.graphic)"></input></div>' var title = attr.from_user + " tweets…"; map.infoWindow.resize(300,230); map.infoWindow.setTitle(title); dojo.byId('infoWindowContents').innerHTML = content; $('#infoWindowContents a').each( function() { $(this).attr('target', '_BLANK'); }); esri.show(dojo.byId("infoWindowContents")); var screenPoint = evt.screenPoint; map.infoWindow.show(evt.graphic.geometry, map.getInfoWindowAnchor(screenPoint)); }
Solved! Go to Solution.
content += '<div align="center"> <button id = "addTweetButton" type="button"></button></div>'
var button = new dijit.form.Button({ label: "Add to Database", onClick: function(){ addTwitterToDatabase(graphic); } }, "addTweetButton");
function twitterPopup(evt){ hideAll(); graphic = evt.graphic; var attr = graphic.attributes; var newDate = (attr.created_at).replace('+0000', 'UTC'); var content = ''; if (attr.profile_image_url) { content = '<a class="twImage" href="http://twitter.com/' + attr.from_user + '" target="_blank"><img class="shadow" src="' + attr.profile_image_url + '" width="48" height="48"></a>'; } content += '<p>' + replaceURLWithLinks(attr.text) + '</p>'; content += '<div class="clear"></div><ul class="iwContentList"><li><b>Location:</b> (' + attr.geo.coordinates + ')</li><li><b>Created:</b> ' + newDate + '</li></ul></div><br/>'; content += '<div align="center"> <button id = "addTweetButton" type="button"></button></div>' var title = attr.from_user + " tweets…"; map.infoWindow.resize(300,230); map.infoWindow.setTitle(title); dojo.byId('infoWindowContents').innerHTML = content; /*Open all links in a new window*/ $('#infoWindowContents a').each( function() { $(this).attr('target', '_BLANK'); }); esri.show(dojo.byId("infoWindowContents")); var screenPoint = evt.screenPoint; map.infoWindow.show(evt.graphic.geometry, map.getInfoWindowAnchor(screenPoint)); var button = new dijit.form.Button({ label: "Add to Database", onClick: function(){ addTwitterToDatabase(graphic); } }, "addTweetButton"); }
content += '<div align="center"> <button id = "addTweetButton" type="button"></button></div>'
var button = new dijit.form.Button({ label: "Add to Database", onClick: function(){ addTwitterToDatabase(graphic); } }, "addTweetButton");
function twitterPopup(evt){ hideAll(); graphic = evt.graphic; var attr = graphic.attributes; var newDate = (attr.created_at).replace('+0000', 'UTC'); var content = ''; if (attr.profile_image_url) { content = '<a class="twImage" href="http://twitter.com/' + attr.from_user + '" target="_blank"><img class="shadow" src="' + attr.profile_image_url + '" width="48" height="48"></a>'; } content += '<p>' + replaceURLWithLinks(attr.text) + '</p>'; content += '<div class="clear"></div><ul class="iwContentList"><li><b>Location:</b> (' + attr.geo.coordinates + ')</li><li><b>Created:</b> ' + newDate + '</li></ul></div><br/>'; content += '<div align="center"> <button id = "addTweetButton" type="button"></button></div>' var title = attr.from_user + " tweets…"; map.infoWindow.resize(300,230); map.infoWindow.setTitle(title); dojo.byId('infoWindowContents').innerHTML = content; /*Open all links in a new window*/ $('#infoWindowContents a').each( function() { $(this).attr('target', '_BLANK'); }); esri.show(dojo.byId("infoWindowContents")); var screenPoint = evt.screenPoint; map.infoWindow.show(evt.graphic.geometry, map.getInfoWindowAnchor(screenPoint)); var button = new dijit.form.Button({ label: "Add to Database", onClick: function(){ addTwitterToDatabase(graphic); } }, "addTweetButton"); }