www.webdeveloper.com
Results 1 to 4 of 4

Thread: Display Div If only the home page. HELP

  1. #1
    Join Date
    May 2011
    Posts
    2

    Question Display Div If only the home page. HELP

    I'm using the shopping cart system Volusion, which doesn't allow me have different templates for each page or does it allow php or asap so i have to use JS. My problem is I don't wish to have a sidebar on the home page. So with javascript I'm trying to say only if $var is == to homepage dont display sidebar.

    My javascript is currently not at a high level, and after search the internet I can up with this script. which doesn't seem to show the heading3 but shows the text working. why is this.

    is javascript the best way and easiest way i can do this?; can this be written better? or use jquery for a more modern way?

    Code:
    <script type="text/javascript">
    <!--
    var myPage = homepage;
    
    if(myPage == homepage){
    	var sidebar=" ";
    }else{	
    	var sidebar="";
    		sidebar += "<h3 id='Menu2_Title'></h3>";
    		sidebar += "working";
    }
    //-->
    </script>
    
    <script type="text/javascript">document.write(sidebar);</script>

    thanks for everyone who looks and helps me.

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Not very clear: you can or you can not use PHP, for instance? If not, why? If you can write a javascript code somewhere, definitely you can write a php code as well, if the server has installed PHP, of course

  3. #3
    Join Date
    May 2011
    Posts
    2
    The shopping cart system requires the template file to be .HTML this why I have use java script / jquery.

    I basically want the side bar div not to be displayed on the home page.

  4. #4
    Join Date
    Mar 2009
    Posts
    496
    My javascript is currently not at a high level, and after search the internet I can up with this script. which doesn't seem to show the heading3 but shows the text working. why is this.
    I'm not sure I really understand your problem, but from the code you've quoted its fairly easy to see why the <h3> element doesn't show--there's nothing between <h3> and </h3> at all.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles