Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts

    Opera imagemap hotspot

    How do you dynamically assign a hotspot in Opera

    I can do it in IE7, Mozilla, Firefoz. NS8 simply by creating another map with new co-ordinates and then assigning to the new map name to the imgMap attribute.

    Opera does nothing, not even an error message
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by Mr J View Post
    How do you dynamically assign a hotspot in Opera

    I can do it in IE7, Mozilla, Firefoz. NS8 simply by creating another map with new co-ordinates and then assigning to the new map name to the imgMap attribute.

    Opera does nothing, not even an error message
    Just get a reference to the area element, and inject it with a new co-ordinate string:
    Code:
    <BODY>
    <img src='mypic.jpg'  usemap='#m1' >
    
    <MAP name='m1'>
     <AREA id='area1' coords='0,0,50,50' href='#'>
    </MAP>
    <BR>
    <A HREF='#' onclick='changeMapArea("area1","50,50,100,100")'>Change to 50,50,100,100</A><BR><BR>
    <A HREF='#' onclick='changeMapArea("area1","100,100,150,150")'>Change to 100,100,150,150</A><BR><BR>
    
    <SCRIPT type='text/javascript'>
    
    function changeMapArea(areaId, newCoords)
    {
     if(document.getElementById)
      document.getElementById(areaId).coords=newCoords;
     else
      if(document.all)
       document.all(areaId).coords=newCoords;
    }
    
    </SCRIPT>
    </BODY>

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by Mr J View Post
    How do you dynamically assign a hotspot in Opera

    I can do it in IE7, Mozilla, Firefoz. NS8 simply by creating another map with new co-ordinates and then assigning to the new map name to the imgMap attribute.

    Opera does nothing, not even an error message
    In fact it works, but it works only first time when the function is fired, which is weird
    http://www.codingforums.com/showthre...823#post520823
    Could be a bug... has anyone any idea?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    I will follow the thread(s) and see what turns up.

    There does not appear to be any problems using the DOM method to set new coords and append new area tags
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #5
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by Kor View Post
    In fact it works, but it works only first time when the function is fired, which is weird
    http://www.codingforums.com/showthre...823#post520823
    Could be a bug... has anyone any idea?
    That code works in Opera 8.54, under which there's no need to use removeAttribute/setAttribute.
    Code:
    obj.useMap=v;
    is all that's required, same for I.E. and Moz.
    I think it's clear that problem arises with Opera 9.x , which has been broken in so many other ways.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •