chinmay.sahoo
New member
Code:
function drawDot(x, y)
{
// print dot image
document.write("<A HREF = \"javascript:alert(\'X = " + x + ", Y = " +
y + "\')\"><IMG SRC = 'dot.gif' HEIGHT = 4 WIDTH = 4 BORDER = 0></A>")
}
This function basically prints the dot image, but it prints it as a hypertext link. The URL specified as the link is a JavaScript statement. When the user clicks the image, an alert box is displayed, presenting the coordinates of that
dot. The coordinates are given to this function as arguments. For example, if the arguments are –5 and 10, then the following string is printed to thedocument:
Code:
<A HREF = "javascript:alert('X = –5, Y = 10')"><IMG SRC = 'dot.gif'
HEIGHT = 4 WIDTH = 4 BORDER = 0></A>