Javascript html changing -


i using javascript dynamically change webpage, , trying make change html well, if have html in javascript, won't execute beginning parts. here javascript:

function home() {     document.getelementbyid("title").innerhtml=("home");     document.getelementbyid("bodyfill").innerhtml=("home stuff here");      var newhtmlhome = "a href="#" title="home" class="active">home/a>";      document.getelementbyid('hometab').innerhtml = newhtmlhome;      var newhtmluser = "a href="javascript:user()" title="home" class="active">home/a>";      document.getelementbyid('usertab').innerhtml = newhtmluser; }  function user() {     document.getelementbyid("title").innerhtml=("user");     document.getelementbyid("bodyfill").innerhtml=("user stuff here");      var newhtmlhome = "a href="javascript:home()" title="home" class="active">home/a>";      document.getelementbyid('hometab').innerhtml = newhtmlhome;      var newhtmluser = "a href="#" title="home" class="active">home/a>";      document.getelementbyid('usertab').innerhtml = newhtmluser; } 

i trying change active tab dynamically, supposed do, doesn't, ideas why? if need more code let me know. in advance!

edit: had change links code, assume tags correct in case

your problem don't escape special characters in string, example:

var newhtmlhome = "<a href="#" title="home" class="active">home</a>"; 

instead, try like:

var newhtmlhome = '<a href="#" title="home" class="active">home</a>'; 

please take here or hereto understand happens.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -