Solved

Controlling table content with links

Posted on 2003-10-24
12
152 Views
Last Modified: 2010-04-09
Hello

Is it possible to control the contents of a table within an html page with links and if so how?. I know you can control frame content but I wanted to change the information within a particular table when the viewing clicks on a menu link.

Thanks

Reidy

0
Comment
Question by:reidy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
12 Comments
 
LVL 8

Accepted Solution

by:
fozylet earned 38 total points
ID: 9614531
Use a div inside the table. Here is a sample code.

<html>
<head>
<SCRIPT language="javascript">
function swapText(obj) {    
obj.innerHTML = "Dynamic Content";
}    
</SCRIPT>
</head>
<body>
<table><tr><td>
<div id="dynCont">
Initial Text
</div>
</td></tr></table>

<a href=# onClick="javascript:swapText(dynCont)">Try Me!</a>
</body>
</html>
0
 
LVL 4

Assisted Solution

by:apprenti
apprenti earned 37 total points
ID: 9614964
I think you need the quotes:

<html>
<head>
<SCRIPT language="javascript">
<!--
function swapText(obj) {    
document.getElementById(obj).innerHTML = "Dynamic Content";
}    
// -->
</SCRIPT>
</head>
<body>
<table><tr><td>
<div id="dynCont">
Initial Text
</div>
</td></tr></table>

<a href="javascript://" onClick="swapText('dynCont')">Try Me!</a>
</body>
</html>
0
 
LVL 8

Expert Comment

by:fozylet
ID: 9615006
We are not passing a string, it is an object variable.
Putting quotes to it will change it to a string, i guess.
note that our javascript codes are differend and I use an object while you use the object name.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:reidy
ID: 9615410
Hello fozylet and apprenti

Thanks I got both of your scripts working ok but I can't seem to get the text to appear over multiply lines, basically I wanted to have scrollable text paragraphs within the table or even several images. I don't know if this is possible as I' new to html and javascript.
0
 
LVL 4

Expert Comment

by:apprenti
ID: 9615450
Have you tried moz.
0
 
LVL 4

Expert Comment

by:apprenti
ID: 9615460
...My copy of moz does not run fozylet's.
0
 
LVL 4

Expert Comment

by:apprenti
ID: 9615498
"Dynamic<br> Content"
+"More dynamic<br>Content"
0
 
LVL 8

Expert Comment

by:fozylet
ID: 9615678
did not try moz... tested only on IE
getElementById is the recommended way to go, i think
0
 

Author Comment

by:reidy
ID: 10662678
yes I agree with the comment from mplungjan with regards to splitting the points
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 10664712
So feel free to do it...
Please click split points above the entry field and follow instructions
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to calculate height of a text using jquery 3 57
Html using "Or" in condition 3 42
Calculating percentage 2 49
allow link tag to be submit like form 15 60
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question