SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Onclick Method

  1. #1
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Onclick Method

    Hi all,

    When I click on the image link the relevant id should change. But it doesn't.

    Why is this?? Tried adding form tags but no difference.

    Code:
    <a href="#" onclick="document.getElementById('lrg_img').src="img1.jpg"> <img src="img.jpg" id="" height="80" width="80" /> </a>
    
    <img src="img.jpg" id="lrg_img" class="showcase_main" />

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are mixing " with ', resulting in an incorrect onclick. Check the JavaScript console in Firefox, it always point out where the error occurred.

  3. #3
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for that.


Bookmarks

Posting Permissions

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