Web Analytics Made Easy -
StatCounter HTML file not opening from image link - CodingForum

Announcement

Collapse
No announcement yet.

HTML file not opening from image link

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTML file not opening from image link

    Hello

    I have a JS which I have already started to try to customise, but I am having some difficulty with it in that when I click on an image, it does not take me to my html page. This is the script:

    Code:
    <head>
    <script type="text/javascript" src="../_common/js/mootools.js"></script>
    <script type="text/javascript" src="imageMenu.js"></script>
    
    <script type="text/javascript">
    			
    			window.addEvent('domready', function(){
    				var myMenu = new ImageMenu($$('#imageMenu a'),{openWidth:310, border:2, onOpen:function(e,i){alert(e);}});
    			});
    </script>
    </head>
    
    <body> 
    <div id="imageMenu">
    <ul>
    
    <li class="landscapes"><a href='care.html'>Landscapes</a></li>
    <li class="people"><a href="http://www">People</a></li>
    
    etc
    </ul>
    </div>
    I have replaced the original script, that is:

    Code:
    <li class="landscapes"><a href="http://www.mysite.com">Landscapes</a></li>
    
    <li class="people"><a href="http://www.mysite.com">People</a></li>
    with care.html. Although all files are in the same folder, I get an error indicating that the fille cannot be found (I have checked the file name spelling).

    I am not doing any of this online as the Web pages, when working, will be put on CDs.

    Thanks for any advice.

    Steve

  • #2
    I don't suppose you can show this live, somewhere?

    Obviously, we can't repro this because you talk about clicking on images, yet there aren't any images in your HTML. I assume they are being supplied by jQuery or some similar technology that you aren't showing completely.
    Be yourself. No one else is as qualified.

    Comment


    • #3
      Hello Old Pedant

      Many thanks for your reply.

      Here is the link:

      http://stevehigham59.7host.com/Image...main1Test.html

      This is the code behind it:

      Code:
      <head>
      <link rel="stylesheet" href="../_common/css/main.css" type="text/css" media="all">
      
      <link href="imageMenu.css" rel="stylesheet" type="text/css" />
       
      <script type="text/javascript" src="../_common/js/mootools.js"></script>
      <script type="text/javascript" src="imageMenu.js"></script>
       
      <body> 
      <li class="landscapes"><a href="page2.html">Landscapes</a></li>
      <li class="people"><a href="http://www">People</a></li>
      <li class="nature"><a href="http://www">Nature</a></li>
      <li class="urban"><a href="http://www">Urban</a></li>
      <li class="abstract"><a href="http://www">Abstract</a></li>
      			
      <script type="text/javascript">
      			
      window.addEvent('domready', function(){
       var myMenu = new ImageMenu($$('#imageMenu a'),{openWidth:310, border:2, onOpen:function(e,i){alert(e);}});
      			});
      		</script>
      </body>
      As you will see if you click on the landscape image, I get an error message.

      Page 2 is in the same directory as main1Text.html on the server.

      Cheers for any help.

      Steve
      Last edited by SteveH; Apr 16, 2009, 11:37 AM.

      Comment


      • #4
        I assume "I get an error message" is no longer true?

        Because when I click on it, I get an alert message that displays the right URL:
        http://stevehigham59.7host.com/Image...enu/page2.html

        And I assume that is coming from code that apparently you added:
        onOpen:function(e,i){alert(e);}});

        So I would also assume you could make the link actually work by just changing that to
        onOpen:function(e,i){location.href=e;}});

        No?
        Be yourself. No one else is as qualified.

        Comment


        • #5
          Hello Old Pedant

          Thanks again for your post.

          I have replaced what I had with your script and this time, yes, it shows the 'page2.html' file when I click on image2 (which is what I was hoping for).

          http://stevehigham59.7host.com/Image.../thisTEST.html

          However, it takes me away from the page which contains the top row of images, instead of placing the content for page2.html underneath those images (in the same way that a top frame maintains the content of the top frame, while changing the content of the main pane below it - if you know what I mean).

          But thanks again for your script; I feel as if I'm getting closer!

          Cheers

          Steve

          Comment


          • #6
            You could load page2.html into your main document dynamically, but honestly, if want the top row of images to show in every page, just put it into every page.
            .My new Javascript tutorial site: http://reallifejs.com/
            .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
            .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

            Comment


            • #7
              Hello venegal

              Thanks for your message.

              Even if I opted to do that, and simply redirected the user to a wholly different page I would not be able to as the links from the photos only generate errors.

              This applies whether I am trying to link to a page I already have on a server or a local file on my computer where all the files are in one folder. Eg:

              Code:
              <li class="landscapes"><a href="http://www">Landscapes</a></li>
              <li class="people"><a href="page2.html">People</a></li>
              <li class="nature"><a href="http://www">Nature</a></li>
              <li class="urban"><a href="http://www">Urban</a></li>
              <li class="abstract"><a href="http://www.mysite.com/ImageTest/contact.html">Abstract</a></li>
              I should be able to open both types of files from the photo link, so what is likely causing this?

              Thanks.

              Steve

              Comment


              • #8
                I don't understand what you mean by "the links from the photos only generate errors". The links in in your code snippet (except the "people" one) obviously do, but they are bogus, so that's to expect.

                I've had a look at your site, the link to page2.html works perfectly. You just have to put something in that page and link the other images to pages the same way.
                .My new Javascript tutorial site: http://reallifejs.com/
                .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
                .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

                Comment

                Working...
                X