×

Discussion Board

Results 1 to 2 of 2

Thread: Onclick issues

  1. #1
    Regular Contributor
    Join Date
    Oct 2003
    Location
    Portland, OR
    Posts
    152

    Onclick issues

    Hi everyone,

    I am trying to construct a div from JS. I want to show some text and an image. When clicking on the image it is supposed to call a JS function that clears the screen and puts other stuff on it. But I can't get the onclick to work. I've tried a few things

    Code:
    function showAbout() {
    	clearDisplayDiv();
    	displayDiv = displayDiv + "<br><br><br><center>BLA BLA BLA<br><br><p><a id=\"closeButton\" href=\"#\"><img src=\"close.gif\"></a></p></center>";
    	document.getElementById("fullView").innerHTML = displayDiv;
    	var self = this;
    	var closeButton = document.getElementById("closeButton");
    	closeButton.onclick = function() {
    		 self.selectViewMode();
    	};
    }
    and....

    Code:
    function showAbout() {
    	clearDisplayDiv();
    	displayDiv = displayDiv + "<br><br><br><center>BLA BLA BLA<br><br><p><img src=\"close.gif\" id=\"closeButton\" onclick=\"selectViewMode();\"></a></p></center>";
    	document.getElementById("fullView").innerHTML = displayDiv;
    }
    But none of these two things work. When clicking on the image, nothing happens. Am I missing something here????

    Mounir

  2. #2
    Registered User
    Join Date
    Sep 2008
    Location
    Manaus, Brazil
    Posts
    109

    Re: Onclick issues

    Code:
    function showAbout() {
    	clearDisplayDiv();
    	displayDiv = displayDiv + '<br><br><br><center>BLA BLA BLA<br><br><p><a href="#"><img id="closeButton" src="close.gif" /></a></p></center>";
    	document.getElementById("fullView").innerHTML = displayDiv;
    	var closeButton = document.getElementById("closeButton");
    	closeButton.onclick = function() {
    		 selectViewMode();
    	};
    }
    Code:
    function showAbout() {
    	clearDisplayDiv();
    	displayDiv = displayDiv + '<br><br><br><center>BLA BLA BLA<br><br><p><img src="close.gif" id="closeButton" onclick="javascript:selectViewMode();"></a></p></center>";
    	document.getElementById("fullView").innerHTML = displayDiv;
    }
    Javier Zambrano Ferreira

Similar Threads

  1. GCCE issues
    By apsaarin in forum Symbian Tools & SDKs
    Replies: 18
    Last Post: 2010-06-18, 13:13
  2. Nokia 6085 - Push Registry Issues
    By alam.sher in forum Mobile Java Networking & Messaging & Security
    Replies: 9
    Last Post: 2009-02-10, 21:09
  3. N91 WiFi (WLAN) and Bluetooth Issues.
    By danscoop in forum General Development Questions
    Replies: 12
    Last Post: 2007-06-05, 20:07
  4. 3gp streaming issues
    By njahan in forum Streaming and Video
    Replies: 0
    Last Post: 2006-11-02, 19:05
  5. Series 60 graphics and sound issues
    By Teh_Architect in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-08-08, 11:03

Posting Permissions

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