Click to See Complete Forum and Search --> : Help newbie with simple question
amoghul
04-16-2003, 06:36 AM
Hi
Im new to javascripting and HTML. I know the basics and i have a programming background.
I have a simple request:
In an HTML page, i want to add a simple link, or button, which when clicked, goes to a specified directory (relative/local directory) and reads a file (more HTML code) and displays this on the page too.
Basically, i am developing pages for computer products. The basic information will be displayed. Then, if the user wants more information such as detailed product information, or specs, then user will click on 'Spec' which will expand in the same page and pull out the information from a local HTML file.
If i can do this in a little embedded window, which can be scrolled, this would even be better. I would rather not have popups, it has to be within the same window.
Not sure if Javascript or DHTML or anything else would be better - but any help appreciated greatly.
Many thanks
DrDaMour
04-16-2003, 07:31 AM
you need to check out <iframe stc="url"></iframe> tag. It's an inset frame, i think it's exactly what you want.
amoghul
04-16-2003, 08:40 AM
How then do i hide the iframe until someone clicks a btton or link?
I want something like this....
TEXT TEXT TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT TEXT TEXT
Specifications +
The + will be a link which brings up the iframe dialog.
but iframe doesnt display until user clicks the "+
thanks
sabretooth80
04-16-2003, 08:56 AM
hi,
you can put the iframe inside a <div id="frameDiv">... </div>
then <body onload='top.frameDiv.style.display = "none";'>
to display the iframe when the + is clicked you need:
onclick='top.frameDiv.style.display = "block";'
sabretooth
DrDaMour
04-16-2003, 09:13 AM
if the information is in another html file, just make the + a link to the selected information. The frame works exactly like the main browser window.
amoghul
04-16-2003, 10:06 AM
Thanks for all the help, but i guess i must be an extra newbie :(
My HTML code is below, which seems to work fine with the IFRAME command. I just need the clicking part to work before it expands and i will be happy.
If i post my html - please make the amendments and repost.
Thanks to all who responded
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Specifications</title>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="577" id="AutoNumber1" height="359">
<tr>
<td height="158" width="385">SAMSUNG product<p>some main text</td>
</tr>
<tr>
<td height="27" width="385">
Specifications <b>>></b></tr>
<tr>
<td height="174" width="385">
<IFRAME
SRC="../../../../tmp/try.html"
WIDTH=560 HEIGHT=290
ALIGN=RIGHT name="I1"
>
<TABLE ALIGN=RIGHT BORDER=1 CELLPADDING=5></TABLE></IFRAME>
</td>
</tr>
</table>
DrDaMour
04-16-2003, 10:16 AM
i think your lost as to what goes in teh iframe. the main page should have a list of products, adn an iframe. The iframe changes according to what product is picked. Then if they click specifications teh iframe changes again to a more detailed html file. Use the target= in yoru anchors to send the href to teh iframe
khalidali63
04-16-2003, 10:29 AM
Here is the another look.
you have several links on the page pointing to a specific specs.html
<a href="spec1.html" target="displayIFrame">Spec1</a>
<a href="spec2.html" target="displayIFrame">Spec2</a>
<a href="spec3.html" target="displayIFrame">Spec3</a>
<iframe name="displayIFrame" WIDTH=560 HEIGHT=290
ALIGN=RIGHT name="I1"></iframe>
Hope this helps
Cheers
Khalid
amoghul
04-16-2003, 10:50 AM
Khalid.
Thanks - that code is very close to what i need!
I can make use of it, the only change now is that i would prefer to have the frame filled with something initially, e.g the contents of spec1.
can you just advise me how that would work :)
Thanks to all
DrDaMour
04-16-2003, 10:51 AM
<iframe src="URL">
khalidali63
04-16-2003, 10:55 AM
yes as the above post suggested.
just add src attribute with the url of the initial page
e.g
src="someInitalPage.html"
Khalid