Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Editing html with javascript

pwlindseypwlindsey Posts: 1Member
I'm fairly new to javascript, I should lead off with that.

The layout of the website I'm building includes a header at the top of the page and a sidebar with nav buttons along the side. What I'm trying to do is that when a nav button is clicked on, it doesn't direct to a whole new .html file, but just changes the elements within the body section in the same index.html file.

I know I could just direct the links to new .html files, but I'd really like to do it in javascript instead.

Here's some of the code I've been using:

function updateBody() {
var body=document.getElementById("body");
var image=document.getElementById("mainImage");
body.removeChild(image);
document.getElementById('bodyText').innerHTML="

This is the new body text

";
};

Basically trying to remove whatever the existing img element is, then change the body text. This seems to work, except when I try to go back the other way nothing happens.

Any help would be greatly appreciated!

Comments

  • 1048jack111048jack11 Posts: 26Member
    I don't know the JavaScript.but im interested in web design

    Having now seen what both consoles can do, that's clear to me because gamers have been persuaded by a very slick, shiny presentation which preceded the E3 festivities last Monday. Riddling your press conference attendees with alcohol and free food from multiple cuisines tends to get people up on their seats. Sony's presentation was fun, though, and I think the cheesy competitiveness is good for the industry, which I feel is a bit stale.

    One of my biggest disappointments of E3 was Knack, a launch day platformer that looked the goods to show off the PS4's capabilities. It plays like a PS2 game and looks like a glossy, shiny PS3 downloadable title. I won't be surprised if it ends up a download-only title. Infamous: Second Son looks great, though, as does Killzone.

    But they are just games, and I left Los Angeles feeling that the entire new generation of gaming consoles lacks the excitement of last generation.

    Microsoft, while still part of that stale and trivial new generation, is in a different situation, because it showed to journalists the Xbox One in a different light.

    http://www.gameguyz.com/news/game-vendor/sony-won-the-pr-battle-but-lost-the-e3-war.html


    [url=http://www.gameguyz.com/]new games 2013[/url]
    [url=http://www.gameguyz.com/news.html]game news[/url]
    [url=http://www.gameguyz.com/pictures.html]game wallpaper hd[/url]
    [url=http://www.gameguyz.com/videos.html]games video[/url]
  • 1048jack111048jack11 Posts: 26Member
    I don't know the JavaScript.but im interested in web design

    Having now seen what both consoles can do, that's clear to me because gamers have been persuaded by a very slick, shiny presentation which preceded the E3 festivities last Monday. Riddling your press conference attendees with alcohol and free food from multiple cuisines tends to get people up on their seats. Sony's presentation was fun, though, and I think the cheesy competitiveness is good for the industry, which I feel is a bit stale.

    One of my biggest disappointments of E3 was Knack, a launch day platformer that looked the goods to show off the PS4's capabilities. It plays like a PS2 game and looks like a glossy, shiny PS3 downloadable title. I won't be surprised if it ends up a download-only title. Infamous: Second Son looks great, though, as does Killzone.

    But they are just games, and I left Los Angeles feeling that the entire new generation of gaming consoles lacks the excitement of last generation.

    Microsoft, while still part of that stale and trivial new generation, is in a different situation, because it showed to journalists the Xbox One in a different light.

    http://www.gameguyz.com/news/game-vendor/sony-won-the-pr-battle-but-lost-the-e3-war.html


    [url=http://www.gameguyz.com/]new games 2013[/url]
    [url=http://www.gameguyz.com/news.html]game news[/url]
    [url=http://www.gameguyz.com/pictures.html]game wallpaper hd[/url]
    [url=http://www.gameguyz.com/videos.html]games video[/url]
Sign In or Register to comment.