Reputation: 9
I am trying to create a web page that has an area that displays different text, depending on what link was clicked. I have looked at if else code, embedding objects, on click command.
Here is some basic code I have put together. Can somebody let me know if I am on the right track or where I am going wrong. I also think I need to use AJAX but I am not familiar with that.
Any help will be greatly appreciated.
<table width="80%" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<div align="center">
<a href="#Step1" class="menuNav">
<strong>Step 1</strong>
</a>
</div>
</td>
<td>
<div align="center">
<a href="#Step2" class="menuNav">
<strong>Step 2</strong>
</a>
</div>
</td>
<td>
<div align="center">
<a href="#Step3" class="menuNav">
<strong>Step 3</strong>
</a>
</div>
</td>
</tr>
</table>
<br />
<object type="text/html" width="80" height="150" border="thin">
<?php
if( onclick = "#Step1" ) {
echo (i hope this work );
} else { }
?>
</object>
Upvotes: 1
Views: 185
Reputation: 1189
Do you mean to have different areas show up for different links? Here is what code would look like for that:
<table width="80%" cellspacing="0" cellpadding="0" align="center">
<tr>
<?php
switch ($_GET['step']) {
case 1:
?>
<td>
<div align="center">
<a href="#Step1" class="menuNav">
<strong>Step 1</strong>
</a>
</div>
</td>
<?php
break;
case 2:
?>
<td>
<div align="center">
<a href="#Step2" class="menuNav">
<strong>Step 2</strong>
</a>
</div>
</td>
<?php
break;
case 3:
?>
<td>
<div align="center">
<a href="#Step3" class="menuNav">
<strong>Step 3</strong>
</a>
</div>
</td>
<?php
break;
}
</tr>
</table>
This is a very simplistic way to display separate portions of markup for different urls. You can then have your users move on to different links to show different blocks (/script.php?step=1, etc)
Upvotes: 0