/    Sign up×
Community /Pin to ProfileBookmark

using links to insert html files into Table

Hi All
i tried putting the most informative title as possible. Hope it worked.

I was hoping one of you experts would be able to assist me with my enquiry.

i have built a site using a table, in dreamweaver.
Here is a very basic look at what i have.

[code=php]<table>
<tr>
<td> picture.jpg</td>
</tr>

<tr>
<td><div id=”myDiv”> scrolling text window </div></td>
</tr>

<tr>
<td>picture.jpg</td>
</tr>
</table>[/code]

at the bottom of the page i have 2 links
“news” and “contact”

i also have 2 text files with all the relating text.

i am wanting to know, is there a way , that when the user
clicks on ‘news’ ..the news.html file is loaded into the middle table.
when the user clicks on ‘contact’ , the contact.html file replaces it.

Basically, an javascript alternative option to the following text , that you would use when dealing with frames

[code=php]<A HREF=”pagename.htm” TARGET=”MAIN-WINDOW”> link </a>[/code]

so far , i have been advised to use

[code=php]
<head>
function changeText(newText){
document.getElementById(“test”).in* nerHTML=newText
}
</head>
<body>
<tr><div id=”myDiv”>scrolling text window</div></tr>

<a href=”#” onClick=document.getElementById(“m* yDiv”).innerHTML=”news.htm”> NEWS </a>
</body>[/code]

however, this example requires a string of text , instead of opening an existing text file

any help is greatly appreciated.

Buttahz

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@cyber1Oct 21.2006 — As fara as I know you have to use an iframe:
[code=html]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

<html>
<head>
<title>Untitled Test</title>
<meta name="generator" content="BBEdit">
<script language="JavaScript">
function changeText(newText){
document.getElementById("I1").src=newText
}

</script>
</head>
<body>
<table>
<tr>
<td id="myDiv">
<iframe name="I1" id="I1" src="http://google.com" border="1" frameborder="0" marginwidth="1" marginheight="1" width="800" height="600"></iframe>

</td>
</tr>
</table>

<a href="#" onClick="changeText('http://cnn.com')"> NEWS </a> |
<a href="#" onClick="changeText('http://google.com')"> GOOGLE </a>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@ButtahzauthorOct 21.2006 — thanks so much cyber1, thats what i needed

Cheers

Buttahz
×

Success!

Help @Buttahz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...