Click to See Complete Forum and Search --> : Help JavaScript Popup Within ASP Page


ejrhodes
04-07-2003, 12:28 PM
Hey all, I am building a site that has a map of the US. The map is marked by 50 different hotspots. What I am trying to do is within the hotspot, once it is clicked, open a pop up window and pass the asp URL in the window.

My code to call the onclick is as follows is as follows:


<area shape="poly" coords="16,81,11,93,12,112,18,127,22,147,26,163,34,167,41,175,47,184,49,191,68,192,75,185,77,180,79,172,41,1 21,49,88,16,78,15,81" href="javaScript:;" onClick="MM_openBrWindow('/states/state.asp?state=CA','map','width=400,height=600')">

My function is:

<script language="JavaScript">
function MM_openBrWindow(theURL,winName,features)
window.open(theURL,winName,features);
</script>


Any help you can provide me with would be appreciated.

Thanks

ejrhodes
04-07-2003, 06:07 PM
Originally posted by Dave Clark
Not sure what king of help you're looking for (you didn't specify).
However, I'd code your AREA tag as follows:

<area shape="poly" coords="16,81,11,93,12,112,18,127,22,147,26,163,34,167,41,175,47,184,49,191,68,192,75,185,77,180,79,172,41,1 21,49,88,16,78,15,81"
href="/states/state.asp?state=CA" target="map"
onClick="return MM_openBrWindow(this.href, this.target, 'width=400,height=600');">

so that it will continue to work even if there is no JavaScript to help.
As for the function, code that as follows:

<script language="JavaScript">
function MM_openBrWindow(theURL, winName, features)
{
var ptr = window.open(theURL, winName, features);
return false;
}
</script>

Dave



Thanks a lot, I will try that out later today. You are right, I forgot to ask the question, which was, why doesn't what I am doing work? :)

Thanks

ejrhodes
04-07-2003, 07:33 PM
Originally posted by Dave Clark
It was probably the missing braces for your function definition. You should turn on error reporting
in your browser so that you can see the error message that is being generated for such things.

Dave

You sir were correct. Major oversite on my part as I am new to Javascript. Thanks a lot for the help