#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    24
    Rep Power
    0

    Help JavaScript Popup Window Within ASP Page


    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:

    PHP Code:
    <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,121,49,88,16,78,15,81"    href="javaScript:;" onClick="MM_openBrWindow('/states/state.asp?state=CA','map','width=400,height=600')"
    My function is:

    PHP Code:
    <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
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2003
    Location
    Italy, EU
    Posts
    517
    Rep Power
    12
    Try to do this way:
    1. add the parenthesis in the function definition even if there's just one line
    2. remove the HREF parameter in the AREA tag
    3. substitute the actual onClick with onClick="JavaScript:MM_openBrWindow('/states/state.asp?state=CA','map','width=400,height=600')"

    and it should work.

    Bye
    Last edited by magma; April 7th, 2003 at 01:35 PM.
  4. #3
  5. No Profile Picture
    Web Hosting Montreal rep
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Location
    Montreal
    Posts
    9
    Rep Power
    0

    href="#"


    try replacing

    href="java script:;"

    with

    href="#"

    It's my basic solution for when I want my links
    to execute javascript.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2001
    Posts
    765
    Rep Power
    13
    You left something out: what's the problem?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    24
    Rep Power
    0
    Originally posted by mrrichardfeder
    You left something out: what's the problem?
    Good point, the question was what I have gets me an error: object Expected and no pop-up window.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2001
    Posts
    765
    Rep Power
    13
    Aha! The old 'object expected'...always means the same thing in IE: where's my function?

    function MM_openBrWindow(theURL,winName,features) {
    window.open(theURL,winName,features);
    }

    Forgot those curlies...
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    24
    Rep Power
    0
    Originally posted by mrrichardfeder
    Aha! The old 'object expected'...always means the same thing in IE: where's my function?

    function MM_openBrWindow(theURL,winName,features) {
    window.open(theURL,winName,features);
    }

    Forgot those curlies...
    thanks a lot, I will try it out a little later. thanks a lot

    You were correct. Thanks a lot.
    Last edited by ejrhodes; April 7th, 2003 at 07:33 PM.

IMN logo majestic logo threadwatch logo seochat tools logo