Hi, I am fairly new to javascript. my question might be elementary. here is the scenario: my html looks like this: <div id="dynamicTag"></div> <a href="#" onclick="loadText('encounter')">encounter</a> <a href="#" onclick="loadText('service')">service</a> ---------------------------------------------- my javascript looks like this: function loadText(category){ var newCategory = category; var myDiv = document.getElementById('dynamicTag'); myDiv.innerHTML = newCategory; } looks simple right? I'm just changing the text inside of <div id="dynamicTag"> Well on IE, Firefox, and Netscape it works fine. But it doesnt work right on Opera. The change takes place, but it would go back to default. So if I clicked the link, the text in the div is changed but the text disappears right aftewards...so the text blinks whenever I click. How do I fix this? Any help will be gladly appreciated. thanks!
Works perfectly fine in Opera for me. I went to a random website and right click > Source and I erased the entire page and simply put your coding in it and Applied Changes. When I clicked a link, it put the proper text there and kept it there. Code I put: <script> function loadText(category){ var newCategory = category; var myDiv = document.getElementById('dynamicTag'); myDiv.innerHTML = newCategory; } </script> <div id="dynamicTag"></div> <a href="#" onclick="loadText('encounter')">encounter</a> <a href="#" onclick="loadText('service')">service</a> HTML: Could you possibly link to the page you're doing this on so we can have a real test?
Thanks for the input. After a couple of hours of dabbling with it, I found out that I had an older version of Opera - 9.24 I installed the latest - 9.26 and that solved the problem. wheww!
Odd that the version affected it. I'm still using 9.10. Perhaps it was a bad installation? Well, at least you got it working.