Link to home
Start Free TrialLog in
Avatar of lightning74
lightning74

asked on

I am new to CF, I need to change some html on a page with an onMouseOver or similar event - READ IN PLEASE?

Hi I am new to CF so I don't know if this is possible or not but here goes.

I need to change some html on my page using CF if possible with an onMouseOver type of event. For example I have a form that contains a table with 5 rows, each of the rows displays a different "plan" for the user to choose. When the user rolls over those cells I want some html on the page to "change" or become "visable". I don't want to use javascript if I can help it because the only good way I have found to do this in JS is to use the

document.getElementById().innerHTML

which is limited to only recent browsers. Maybe there is a better way to do it with javascript but it is inside my form and there is more I want to do, like:

next to these five selections in the form will be a button for the user to choose that "plan" and when the user selects the "plan" they want I want the other plans to "hide".

Is this possible?

Here is what the layout resembles:

<form name="choose_plan" action="" method="post">
<table>
  <tr>
    <td>Plan 1</td><input type="image" src="choose_this_plan.gif" value="" name="">
  </tr>
  <tr>
    <td>Plan 2</td><input type="image" src="choose_this_plan.gif" value="" name="">
  </tr>
  <tr>
    <td>Plan 3</td><input type="image" src="choose_this_plan.gif" value="" name="">
  </tr>
  <tr>
    <td>Plan 4</td><input type="image" src="choose_this_plan.gif" value="" name="">
  </tr>
  <tr>
    <td>Plan 5</td><input type="image" src="choose_this_plan.gif" value="" name="">
  </tr>
</table>
</form>

<table>
 <tr>
   <td><img src="plan_image">This text and image to change CF event or otherwise</td>
 </tr>
</table>

ASKER CERTIFIED SOLUTION
Avatar of James Rodgers
James Rodgers
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
made some corrections

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
      
      <script>
      numPlans=5;
      function changeFormDisplay(strShow){
                   var strPlanId="";
                   for (var i=1;i<numPlans+1;i++){
                    strPlanId='Plan'+i;
                    //hideId(strPlanId);
                    document.getElementById(strPlanId).style.display='none';
                   }
        if(strShow!=""){
                                  document.getElementById(strShow).style.display='block';
        }
      }
      
      function hideId(strId){
      
      document.getElementById(strId).style.display='none';
      }
      </script>
</head>

<body>

<form name="choose_plan" action="" method="post">
<select id="selPlan" name="selPlan" style="width:250;" onChange="changeFormDisplay(this.value)">
<option value="">--Select a Plan Option</option>
<option value="plan1">Plan 1</option>
<option value="plan2">Plan 2</option>
<option value="plan3">Plan 3</option>
<option value="plan4">Plan 4</option>
<option value="plan5">Plan 5</option>
</select>

</form>

<table id="tblOptionDisplay" name="tblOptionDisplay" border="1">
<caption><nobr>this is the div table</nobr></caption>
 <tr id="plan1" style="display:none">
   <td>Plan 1 info
   </td>
 </tr>
 <tr id="plan2" style="display:none">
   <td>Plan 2 info
   </td>
 </tr>
 <tr id="plan3" style="display:none">
   <td>Plan 3 info
   </td>
 </tr>
 <tr id="plan4" style="display:none">
   <td>Plan 4 info
   </td>
 </tr>
 <tr id="plan5" style="display:none">
   <td>Plan 5 info
   </td>
 </tr>
 
</table>

</body>
</html>
Dont ever go for visible = true / false for form elements ... as it dosent work in netscape & other browsers

the best deal wld be to use layers & get them to be show / hide as per ur requirement

u wld be using javascript & DHTML !
Avatar of mrichmon
mrichmon

You will have to use Javascript or some other client side scripting language since you want to access the onMouseover event.  The onMouseouver occurs on the client's machine and so therefore it cannot be done using only Cold Fusion which is a server side language.