Jump to content

Need Help With A Website...


Dan6061

Recommended Posts

For my GCSE IT coursework, I'm making a Trials-Shop :rolleyes:

Got this for the website so far

IPB Image

(The iFrame bit isn't actually on the website)

I've just finished the navigation bar, and want all the links to open in the iFrame, instead of in a new page.

How?

Cheers (Y)

Link to comment
Share on other sites

How are you coding the site? are you using a program, or using straight code?

you need to make a layout page containing the frames you want, and use the 'target' command, to to target links into a frame.

looks like you need 3 frames, one top frame for menu, one side frame for picture, and one main frame for content.

Link to comment
Share on other sites

How are you coding the site? are you using a program, or using straight code?

you need to make a layout page containing the frames you want, and use the 'target' command, to to target links into a frame.

looks like you need 3 frames, one top frame for menu, one side frame for picture, and one main frame for content.

yep - a target attribute in the link pointing at the IFrame ID will do it

but ...

Never use frames for laying a site out .

because...

A: they're evil.

B: google doesn't like them & your site won't get searched properly unless you put a load of other stuff in the <noframes> tag in the frameset page (which is a pain in the arse to update later)

I know it doesn't make you feel as clever (and it's a twat to make edits to the menu later on) but you really ought to be sticking to loading a whole new page everytime you hit a link from the menu. You stand a much better chance of the site being searched fully.

You can minimise the effort involved in updating the menu by referencing your javascript from external files like this

<script src="blah" >

Edited by poopipe
Link to comment
Share on other sites

Using straight code - Notepad.

My school isn't cool enough for Dreamweaver :rolleyes::turned:

If someone could type out the code for it, so I could edit it into my coding.... (Y)

Just need a code to follow...

er- don't shoot me if im wrong - its been a couple of years

<a href="whatever" target="IFRAMEID"> linky </a>

Link to comment
Share on other sites

Heres how i would do it personally.

Rename your index to a .php file

Add the following code in place of the iframe

<?PHP

// Lets Get The Variable 'P' From The URL

$page = $_GET['p'];

// If no varaible entered lets goto the default page instead

if (empty($page)) {
    
            include ("content/start.htm");
    
}

// Elce include the page using the name in the variable

else {

    // Lets see if the actual file exists before we load it
    
    if (file_exists("content/".$page.".htm")) {
        include ("content/".$page.".htm");
    }
    
    // If it doesnt load the 404 page instead.
    
    else {
        include ("content/404.php");
    }
    
}
?>[/code] Create a subdirectory called 'content' and place all your content files in there. Then form your links as follows
[code]http://www.myurl.com/index.php?p=filename

Where 'filename' is the filename of the htm page you wish to load.

Link to comment
Share on other sites

Sorry, I'm a bit confused by all the php stuff :$

here's my code so far...

<html>
<head>
<link href="CascadeMenu.css" rel="stylesheet">
<script language="javascript" src="CascadeMenu.js">
</script>
</HEAD>
<body>
<BODY OnLoad="InitMenu()" Onclick="HideMenu(menuBar)" ID="Bdy" bgColor=aliceblue>
<title>www.Trials-Shop.co.uk</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

</head>

<body background="[url="http://img226.imageshack.us/img226/4162/background8yq.jpg"]http://img226.imageshack.us/img226/4162/background8yq.jpg[/url]">

<div align="center">


<table>

<tr>
<td colspan="2" id="header">
<!--No Content Header -->
</td>
</tr>

<tr>

<img src="[url="http://img218.imageshack.us/img218/1442/logojpg6sf.png"]http://img218.imageshack.us/img218/1442/logojpg6sf.png[/url]" ALT="Trials-Shop" border="1">

<DIV Id="menuBar" class="menuBar" >
    <DIV Id="Bar1" class="Bar"  menu="menu1">Navigation</DIV>
    <DIV Id="Bar2" class="Bar"  menu="menu2">Complete Bikes</DIV>
    <DIV Id="Bar3" class="Bar"  menu="menu7">Drivechain</DIV>
    <DIV Id="Bar4" class="Bar"  menu="menu8">Wheels</DIV>
    <DIV Id="Bar5" class="Bar"  menu="menu11">Steering</DIV>
    <DIV Id="Bar6" class="Bar"  menu="menu14">Frames</DIV>
    <DIV Id="Bar7" class="Bar"  menu="menu15">Braking</DIV>
</DIV>
<!--MenuItem Definition -->
<div Id="menu1" class="menu" >
   <div Id="menuItem1_1" class="menuItem"  title="Home" cmd="H:\I.T Folder\G.C.S.E\Trials-Shop\Website\index.html">Home</div>
   <div Id="menuItem1_2" class="menuItem" title="About" cmd="H:\I.T Folder\G.C.S.E\Trials-Shop\Website\about.html">About</div>
   <div Id="menuItem1_3" class="menuItem" title="Order Info" cmd="H:\I.T Folder\G.C.S.E\Trials-Shop\Website\orderinfo.html">Order Info</div>
   <div Id="menuItem1_4" class="menuItem" title="Payment Info" cmd="H:\I.T Folder\G.C.S.E\Trials-Shop\Website\paymentinfo.html">Payment Info</div>
   <div Id="menuItem1_5" class="menuItem" title="Postage" cmd="H:\I.T Folder\G.C.S.E\Trials-Shop\Website\postage.html">Postage</div>
   <div Id="menuItem1_6" class="menuItem" title="Refunds" cmd="H:\I.T Folder\G.C.S.E\Trials-Shop\Website\refunds.html">Refunds</div>
</div>
</div>
<div Id="menu2" class="menu">
   <div Id="menuItem2_1" class="menuItem" menu="menu3">Onza</div>
</div>
<div Id="menu3" class="menu">
   <div Id="menuItem3_1" class="menuItem" menu="menu4">Mod</div>
   <div Id="menuItem3_2" class="menuItem" menu="menu5">24"</div>
   <div Id="menuItem3_3" class="menuItem" menu="menu6">Stock</div>
</div>
<div Id="menu4" class="menu">
   <div Id="menuItem4_1" class="menuItem">T-Vee</div>
   <div Id="menuItem4_2" class="menuItem">T-Bird</div>
   <div Id="menuItem4_3" class="menuItem">T-Pro</div>
   <div Id="menuItem4_4" class="menuItem">T-Mag</div>
</div>
<div id="menu5" class="menu">
    <div Id="menuItem5_1" class="menuItem">Zoot</div>
</div>
<div id="menu6" class="menu">
    <div Id="menuItem6_1" class="menuItem">T-Raptor</div>
    <div Id="menuItem6_2" class="menuItem">T-Rex</div>
    <div Id="menuItem6_3" class="menuItem">Woodstock</div>
</div>
<div id="menu7" class="menu">
    <div Id="menuItem7_1" class="menuItem">Cranks</div>
    <div Id="menuItem7_2" class="menuItem">Chainrings</div>
    <div Id="menuItem7_3" class="menuItem">Chains</div>
    <div Id="menuItem7_4" class="menuItem">Cogs</div>
    <div Id="menuItem7_5" class="menuItem">Pedals</div>
</div>
<div id="menu8" class="menu">
    <div Id="menuItem8_1" class="menuItem">Built</div>
    <div Id="menuItem8_2" class="menuItem">Custom Build</div>
    <div Id="menuItem8_3" class="menuItem" menu="menu9">Rims</div>
    <div Id="menuItem8_4" class="menuItem" menu="menu10">Hubs</div>
</div>
<div id="menu9" class="menu">
    <div Id="menuItem9_1" class="menuItem">Mod</div>
    <div Id="menuItem9_2" class="menuItem">24"</div>
    <div Id="menuItem9_3" class="menuItem">Stock</div>
</div>
<div id="menu10" class="menu">
    <div Id="menuItem10_1" class="menuItem">Front</div>
    <div Id="menuItem10_2" class="menuItem">Rear</div>
</div>
<div id="menu11" class="menu">
    <div Id="menuItem11_1" class="menuItem">Handlebars</div>
    <div Id="menuItem11_2" class="menuItem" menu="menu12">Stems</div>
    <div Id="menuItem11_3" class="menuItem" menu="menu13">Forks</div>
</div>
<div id="menu12" class="menu">
    <div Id="menuItem12_1" class="menuItem">Mod</div>
    <div Id="menuItem12_2" class="menuItem">Stock/24"</div>
</div>
<div id="menu13" class="menu">
    <div Id="menuItem13_1" class="menuItem">Mod</div>
    <div Id="menuItem13_2" class="menuItem">Stock/24"</div>
</div>
<div id="menu14" class="menu">
    <div Id="menuItem14_1" class="menuItem">Mod</div>
    <div Id="menuItem14_2" class="menuItem">24"</div>
    <div Id="menuItem14_3" class="menuItem">Stock</div>
</div>
<div id="menu15" class="menu">
    <div Id="menuItem15_1" class="menuItem" menu="menu16">Disc Brakes</div>
    <div Id="menuItem15_2" class="menuItem" menu="menu17">Rim Brakes</div>
</div>
<div id="menu16" class="menu">
    <div Id="menuItem16_1" class="menuItem">Mechanical</div>
    <div Id="menuItem16_2" class="menuItem">Hydraulic</div>
</div>
<div id="menu17" class="menu">
    <div Id="menuItem17_1" class="menuItem">Mechanical</div>
    <div Id="menuItem17_2" class="menuItem">Hydraulic</div>
</div>
</div><!-- End of Menu -->


<CENTER>
<!-- Main Scrolling Content Frame PHP -->

<div id="content">
<style type="text/css">
<!--
.style1 {font-size: medium;
 font-weight: bold;
}
.style2 {color: #FF0000}
-->
</style>
<div align="bottom">
  <table width="700" border="0">
    <tr>
<div align="center">
</tr>
</table>
<CENTER>
</div>

</body>
</html>
<script language="Javascript1.2">
am = "This function has been disabled.";
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
     alert(am)
     return false;
   }
}

document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;

</script>

<IFRAME SRC="index-text.html" WIDTH=700 HEIGHT=390>
If you can see this, your browser doesn't 
understand IFRAME.  However, we'll still 
<A HREF="index-text.html">link</A> 
you to the file.
</IFRAME>

Link to comment
Share on other sites

oh right - its using mousedown code instead of a link

righty. none of that will work then

Are you sure you want to get into this ?

the code that loads the page is in CascadeMenu.js - you need to point that function at the Iframe

you need to add this to your IFrame tag <IFRAME ID="myIframe">

Somewhere along the line CSS behaviours are in use (judging by the custom menu attribute in the div)

Edited by poopipe
Link to comment
Share on other sites

It's not actually online, all saved onto the computer.

Apart from the images, because the computer was being a pain trying to direct it to the image file :S

Danny: I'm using the iframe becuase I thought it'd be easier, so all the pages just load up in that, instead of loading up a whole new page.

Unless there's an easier way... :ermm:

Edited by Dan6061
Link to comment
Share on other sites

It's not actually online, all saved onto the computer.

Apart from the images, because the computer was being a pain trying to direct it to the image file :S

Danny: I'm using the iframe becuase I thought it'd be easier, so all the pages just load up in that, instead of loading up a whole new page.

Unless there's an easier way... :ermm:

sod it mate - I'd just load a new page

Link to comment
Share on other sites

sod it mate - I'd just load a new page

Yeah thinking about it, sounds a lot more lesshassle.

Hmm...So now I need a box for all the info etc to go into.

Like where the iFrame is, but no an iFrame...If you get me?

:rolleyes:

By the way, the javascript code at the bottom is to disable right clicking.

Found it on a javascript website, so though I might use it :P

<script language="Javascript1.2">
am = "This function has been disabled.";
bV = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
if (bNS && e.which > 1){
alert(am)
return false
} else if (bIE && (event.button >1)) {
alert(am)
return false;
}
}

document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;

</script>

(Y)

Edited by Dan6061
Link to comment
Share on other sites

Cascade menu.js:

  
    function InitMenu()
    {
      var bar = menuBar.children     

      for(var i=0;i < bar.length;i++) 
         {
           var menu=eval(bar[i].menu)
           menu.style.visibility = "hidden"
           bar[i].onmouseover = new Function("ShowMenu("+bar[i].id+")")
           var Items = menu.children
           for(var j=0; j<Items.length; j++)
             {
               var menuItem = eval(Items[j].id)
                 
                 if(menuItem.menu != null)
                    { 
                     menuItem.innerHTML += "<Span Id="+menuItem.id+"_Arrow class='Arrow'>4</Span>"
                     //var tmp = eval(menuItem.id+"_Arrow")
                     // tmp.style.pixelLeft = menu.getBoundingClientRect().Right //- tmp.offsetWidth - 15
                     FindSubMenu(menuItem.menu)}
                
                  if(menuItem.cmd != null) 
                    {
                    menuItem.onclick = new Function("Do("+menuItem.id+")") } 
                    
               menuItem.onmouseover = new Function("highlight("+Items[j].id+")")
             
             }    
         
         }  
    }
    function FindSubMenu(subMenu)
    {
          var menu=eval(subMenu)
          var Items = menu.children
           for(var j=0; j<Items.length; j++)
             {
               menu.style.visibility = "hidden"
               var menuItem = eval(Items[j].id)
               
               
               if(menuItem.menu!= null)
                  {
                     menuItem.innerHTML += "<Span Id="+menuItem.id+"_Arrow class='Arrow'>4</Span>"
                     // var tmp = eval(menuItem.id+"_Arrow")
                     //tmp.style.pixelLeft = 35 //menuItem.getBoundingClientRect().right - tmp.offsetWidth - 15
                     FindSubMenu(menuItem.menu)
                  }

                  if(menuItem.cmd != null) 
                    {
                    menuItem.onclick = new Function("Do("+menuItem.id+")") } 
                   
               menuItem.onmouseover = new Function("highlight("+Items[j].id+")")
                  
             }  
    } 
    function ShowMenu(obj)
    {
      HideMenu(menuBar)
      var menu = eval(obj.menu)
      var bar = eval(obj.id)
      bar.className="barOver"
      menu.style.visibility = "visible"
      menu.style.pixelTop =  obj.getBoundingClientRect().top + obj.offsetHeight + Bdy.scrollTop
      menu.style.pixelLeft = obj.getBoundingClientRect().left + Bdy.scrollLeft
    }
    
    function highlight(obj)
    {
      var PElement = eval(obj.parentElement.id)
      if(PElement.hasChildNodes() == true)
      {  var Elements = PElement.children
        for(var i=0;i<Elements.length;i++)
        {
           TE = eval(Elements[i].id)
           TE.className = "menuItem"
        }
       } 
      obj.className="ItemMouseOver"
      window.defaultStatus = obj.title
      ShowSubMenu(obj)
    }
    
    function Do(obj)
    {
     var cmd = eval(obj).cmd    
     window.navigate(cmd)
      
    }
    
    function HideMenu(obj)
    {
           if(obj.hasChildNodes()==true)
               {  
                  var child = obj.children     
                  
                  for(var j =0;j<child.length;j++)
                   {
                      if (child[j].className=="barOver")
                      {var bar = eval(child[j].id)
                       bar.className="Bar"}
                       
                      if(child[j].menu != null)
                        {
                           var childMenu = eval(child[j].menu)
                           if(childMenu.hasChildNodes()==true) 
                                HideMenu(childMenu)
                           
                            childMenu.style.visibility = "hidden" 
                          }
                   }
               
               }
    }
   function ShowSubMenu(obj)
   {
      PMenu = eval(obj.parentElement.id)
       HideMenu(PMenu)
      if(obj.menu != null)
      {
      var menu = eval(obj.menu)
      menu.style.visibility = "visible"
      menu.style.pixelTop =  obj.getBoundingClientRect().top + Bdy.scrollTop
      menu.style.pixelLeft = obj.getBoundingClientRect().right + Bdy.scrollLeft
      if(menu.getBoundingClientRect().right > window.screen.availWidth )
        menu.style.pixelLeft = obj.getBoundingClientRect().left - menu.offsetWidth
     }
   } 



 

I'm at home now, going to code it all out on Dreamweaver.

But will still need the help (Y)

I'll post up the new code once i'm done if anyone wants...

Edited by Dan6061
Link to comment
Share on other sites

window.navigate(cmd)
It seams the window.navigate method doesnt support any target parameter according to google. You could try sticking the following in your head but i dont know if it would work with the java or not
<base target="iframename">
Also you stole some of that code of one of the heatink site didnt you :P some of it looks very familiar :P
<!--No Content Header -->
......
<!-- Main Scrolling Content Frame PHP -->[/code]

You could have at least removed my comments :P

Also why do you have some css randomly half way down the page.

Link to comment
Share on other sites

I've copied and pasted it all into DW, and saved the 'cascademenu' files etc..but it's really fecked up.

It looks nothing like how it is at school :S

And none of the menu things are showing, so when I hover the mouse over one, nothing happens, when usually the list will drop :ermm:

And I don't know why I have random bits everywhere, I'm shite at coding on Notepad :closedeyes:

Link to comment
Share on other sites

window.navigate(cmd)

It seams the window.navigate method doesnt support any target parameter according to google.

wouldn't this work ?

window.getElementByID(IFRAME NAME).navigate(cmd)

should put it in the scope of the iframe rather than the parent window

just a thought

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...