Click to See Complete Forum and Search --> : using object tag to embed external html
skaulius
09-16-2004, 07:30 PM
I made a simple static menu using plain html. I have embedded this menu.htm into my main file (index.htm) by using the <object> tag.
I successfully load the index.htm file and see the menu.htm file embedded nicely inside.
But when you click an <a href> link in the menu, the resulting content is trapped in the predefined area of the screen allotted for the <object>.
I would like the content to overtake the screen.
The only workaround seems to be to have the content open in a new window. But I don't want each menu item to have to open in a new window.
text/html based embedded objects seem to function like frames, but there doesn't seem to be any associated code similar to parent/child frame manipulation.
Am I missing something?
Thanks!
PhillMc
09-17-2004, 05:45 AM
Hmm.
If you have Server Side Includes available to you then try this:
<!-- #Include virtual="somepage.htm" -->
This is the method that I use to 'embed' external source.
If you do not have this ability, perhaps the 'target' attribute of the 'a' element would help you. Check out the HTML Tutorials link in my signature. You should find some answers there. :)
skaulius
09-17-2004, 09:41 AM
Thanks :)
So it sounds like maybe the object tag is not the best thing to use for linking an external static menu.
What would you recommend as the simplest method to link a purely html based static menu? Should I somehow use javascript to call it? I know Dreamweaver has you use library items, but I don't want to be stuck with vendor software.
Thanks!
PhillMc
09-17-2004, 12:18 PM
If server-side includes are available to you, then the method I gave earlier is the easiest.
If you do not, maybe you could try setting the height and width of the 'object' element using CSS or presentational markup in the element declaration itself.
Let me know how it turns out. :)
skaulius
09-17-2004, 03:50 PM
Thanks,
I don't have access to "server-side includes" so I decided to use javascript. It's a bit time consuming, but it works. Here's the solution I came up with...
In the index.htm header I put...
---------------------------
<script src="mymenu.js">
</script>
---------------------------
"mymenu.js" is just a text file which contains...
---------------------------
function WriteMenu(){
mystring="<table>"+
"<tr><td>"+
"<a href='www.url.com'>link</a>"+
"</td></tr>"+
"</table>"
document.write(mystring)
}
---------------------------
That's the time consuming part - after copy/pasting the html code into the text file, it takes a while to put in all of the quotes.
Later in the index.htm file I put...
---------------------------
<script>
WriteMenu();
</script>
---------------------------
And that's it! :)
PhillMc
09-17-2004, 03:55 PM
Yea, it works, but...
What if I don't have javascript or it's disabled? Then I can't use your site. Javascript isn't a bad thing, one just shouldn't use it for site critical items.
Did you try setting the height and width of the object element?
skaulius
09-17-2004, 04:23 PM
I'm not sure what the code would look like to sense an onClick event for the object. If index.htm contains the object code, how does it sense that the object (menu.htm) has been clicked? Then would you need some sort of function to be executed after the onClick event in order to execute the resizing to fullscreen? Furthermore, would this not create objects opening within objects, thus hurting performance?
Thanks :confused:
PhillMc
09-17-2004, 04:47 PM
No, you do not need special code to get a hyperlink in work in embedded HTML.
Again; try setting the height and width of the object element...