943,743 Members | Top Members by Rank

Ad:
Sep 5th, 2008
0

The code looks right but does not work.

Expand Post »
Hi,

In the code below, when I click on the link Colour, it needs to connect to javascript function and display "Hello" or alert message. For some reason, it does not do it.

If anyone spots a mistake, pleeese let me know - I'll be here.

Appreciate!

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6.  
  7. <script language="JavaScript" type="text/JavaScript">
  8. <!--
  9. function tabs() {
  10. alert('hhh');
  11. document.getElementById("contentAA").innerHtml="Hello";
  12. //-->
  13. </script>
  14.  
  15.  
  16. </head>
  17.  
  18. <body>
  19.  
  20. <a href="javascript:void(0);" onClick="tabs()">Colour</a>
  21.  
  22. <div id="contentA"><p id="contentAA"> </p></div>
  23. <div id="contentB"><p id="contentBB"> </p></div>
  24.  
  25. </body>
  26. </html>
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
Mylena is offline Offline
30 posts
since Jul 2007
Sep 5th, 2008
0

Re: The code looks right but does not work.

You don't have the close brace } on the function
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Sep 5th, 2008
0

Re: The code looks right but does not work.

Thanks!!!!!!!!!!!!!!!!!!!
Reputation Points: 10
Solved Threads: 1
Light Poster
Mylena is offline Offline
30 posts
since Jul 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Problem with Radio Button / AJAX
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: how to figer out the page is rendered by the browser





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC