www.webdeveloper.com
Results 1 to 11 of 11

Thread: [RESOLVED] Bookmark not working in Opera with both href and onclick

  1. #1
    Join Date
    Mar 2009
    Posts
    3

    resolved [RESOLVED] Bookmark not working in Opera with both href and onclick

    Hi,

    I am facing a problem in Opera browser where bookmark links are not working for me. I have link with href containing #<linklocation> and also JS function called on onclick event which does hide/show of a div. Test code is present below.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>test page</title>
    </head>
    <body>
    <div style="width: 200px;">
    <div style="display:block;">
    click the link <a href="#testlink" onclick="changeDisplay();">testlink</a>
    </div>
    <div id="uuhelp" style="display:none;">
    <div>
    this is sample text in para1. this is sample text in para1. this is sample text
    in para1. this is sample text in para1. this is sample text in para1. this is sample
    text in para1. this is sample text in para1. this is sample text in para1. this
    is sample text in para1. this is sample text in para1. this is sample text in para1.
    this is sample text in para1. this is sample text in para1. this is sample text
    </div>
    <div id="testlink">
    <h1>New para</h1>
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    text in para2. this is sample text in para2. this is sample text in para2. this
    is sample text in para2. this is sample text in para2. this is sample text in para2.
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    text in para2. this is sample text in para2. this is sample text in para2.
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    text in para2. this is sample text in para2. this is sample text in para2. this
    is sample text in para2. this is sample text in para2. this is sample text in para2.
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    is sample text in para2. this is sample text in para2. this is sample text in para2.
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    </div>
    </div>
    </div>
    <script type="text/javascript">
    function changeDisplay()
    {
    document.getElementById("uuhelp").style.display = "block";
    return false;
    }
    </script>
    </body>
    </html>

    Can anybody please let me know why it is not working?
    Thanks in advance.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    <a href="#testlink" onclick="changeDisplay();document.getElementById('testlink').scrollIntoView();return false;">testlink</a>
    Remove the return false from function changeDisplay
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Mar 2009
    Posts
    3
    not working

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>test page</title>
    </head>
    <body>
    <div style="width: 200px;">
    <div style="display:block;">
    click the link <a href="#testlink" onclick="changeDisplay();document.getElementById('testlink').scrollIntoView();return false;">testlink</a>
    </div>
    <div id="uuhelp" style="display:none;">
    <div>
    this is sample text in para1. this is sample text in para1. this is sample text
    in para1. this is sample text in para1. this is sample text in para1. this is sample
    text in para1. this is sample text in para1. this is sample text in para1. this
    is sample text in para1. this is sample text in para1. this is sample text in para1.
    this is sample text in para1. this is sample text in para1. this is sample text
    </div>
    <div id="testlink">
    <h1>New para</h1>
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    text in para2. this is sample text in para2. this is sample text in para2. this
    is sample text in para2. this is sample text in para2. this is sample text in para2.
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    text in para2. this is sample text in para2. this is sample text in para2.
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    text in para2. this is sample text in para2. this is sample text in para2. this
    is sample text in para2. this is sample text in para2. this is sample text in para2.
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    is sample text in para2. this is sample text in para2. this is sample text in para2.
    this is sample text in para2. this is sample text in para2. this is sample text
    in para2. this is sample text in para2. this is sample text in para2. this is sample
    </div>
    </div>
    </div>
    <script type="text/javascript">
    function changeDisplay()
    {
    document.getElementById("uuhelp").style.display = "block";
    }
    </script>
    </body>
    </html>
    At least 98% of internet users' DNA is identical to that of chimpanzees

  5. #5
    Join Date
    Mar 2009
    Posts
    3
    Great. Working as per my expectation. Thanks a lot.

  6. #6
    Join Date
    Dec 2010
    Posts
    3
    Im experiencing,maybe the same problem

    a have a javascript call in my <head> part

    <script type="text/javascript" src="js.js"></script>

    and the few links

    <li><a href="site_1.html" ><img src="img/img_1.png" width="115" height="115" border="0" /></a></li>

    on all browser exept opera, when clicked on the image, in the specified field the content changes and shows what is on site_1, and etc... site_2...site_3...

  7. #7
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    The html link works correctly. What has JavaScript got to do with the problem?
    At least 98% of internet users' DNA is identical to that of chimpanzees

  8. #8
    Join Date
    Dec 2010
    Posts
    3
    well it doesn't show me anything when viewed in opera.

    the css for the links is

    li a {
    display: block;
    float: left;
    text-decoration: none;
    width: 130px;
    padding-top: 10px;
    padding-bottom: 10px;
    height: auto;
    }

    any help?

  9. #9
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    No image?
    At least 98% of internet users' DNA is identical to that of chimpanzees

  10. #10
    Join Date
    Dec 2010
    Posts
    3
    well the fact is that it worked a week ago when i had opera 9.

    when you clicked on the image, on the particular part of the page a text appeared from the site_1, and
    when you clicked on the another image, also on that part of the page another text appeared from site_2

    that's all happening by the javascript called in head section js.js

    but when i upgraded to opera 10 and now also 11, when clicked on the images,nothing happend

  11. #11
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Could be popups are blocked or JavaScript is disabled
    At least 98% of internet users' DNA is identical to that of chimpanzees

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles