Solved

Controlling table content with links

Posted on 2003-10-24
12
153 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
Industry Leaders: 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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

634 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