This is a GeoGebra worksheet to illustrate domain and range. Click OK to generate a new function.

After clicking OK, you should press Ctrl-F to refresh the screen. I am still trying to figure out how to refresh the screen automatically.

UPDATE: I found another solution, using line segments instead of traces on the axes, which avoids the need to refresh the screen.