Thank you for clarifying!I took a look at your code and there are a number of ways to remedy this problem.First of all, your code is fine in theory. The buttons should trigger a function when clicked and your map should zoom accordingly.onClick='executeZoomToNext("${nextpt}");'
However, the problem is that the value sent by your onClick is not an integer, but literally "${nextpt}" as a string. Because the variable you are trying to access is a javascript variable, the HTML treats this as a simple string. You cannot directly copy/paste javascript variables into an HTML code block.Now, there are two ways to handle this. 1) Change onClick to executeZoomToPrev(); and executeZoomToNext(); respectively and within these specific functions, get the id of the current feature using javascript. This ensures minimal changes to your current code (and is what I would do).
function executeZoomToNext(){
//var currentFeature = GET CURRENT FEATURE CODE
queryTask2 = new esri.tasks.QueryTask(mapservice+"/lurec_systems/MapServer/0");
query2 = new esri.tasks.Query();
query2.returnGeometry = true;
query2.outSpatialReference = map.spatialReference;
query2.outFields = ["objectid", "id", "name", "descrip", "system", "zoomlevel", "nextpt", "url"];
query2.where = "id = "+currentFeature+"";
queryTask2.execute(query2, showResult2);
}
2) Update the value of both onClicks dynamically each time a new feature is selected (using javascript). This way is more slightly more complicated but I have seen it in practice. (Also, this way is more work overall compared to way 1).Hopefully this makes some sense. I can try to explain in a different way if this isn't enough information to lead you in the right direction.Good luck!