SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Threaded View
-
Jun 22, 2007, 02:08 #1
- Join Date
- Apr 2006
- Posts
- 12
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Changing and refreshing div content
Hello all, I have a website with some navigation buttons on top.
When one button is clicked I replace it's content with the content of a red button using this code:
Code:document.getElementById('button').innerHTML = ' <a href="javascript:void(0)"> <img src="header/button_active.jpg" border="0" /> </a>';
Code:<div id="aanbiedingen"> <a href="javascript:void(0)" onclick="open_url('page.php','CONTENT_CENTER');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Aanbiedingen','','button_inactive.jpg',1)" > <img src="1px_tranceparent.gif" name="Aanbiedingen" width="99px" height="20px" border="0" /> </a> </div>
Using this code a button becomkes red once you click it. This is what I want.
Just one problem: when I click on another button, the first one stays red because it doesn't reload the page.
Now I thought, I'll refresh the navigation page using a div and ajax.
Code:open_url('navigation.php', 'navigation');
But when I implement this code before the page load. JavaScript can no longer access the div elements in navigation.php
Anyone knows why?
Firebug says this when I refresh the navigation:
document.getElementById("button") has no properties
Thanks in advance!
Bookmarks