Solved

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

Posted on 2003-11-15
6
188 Views
Last Modified: 2013-12-24
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>

0
Comment
Question by:lightning74
[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
  • 2
6 Comments
 
LVL 25

Accepted Solution

by:
James Rodgers earned 125 total points
ID: 9757271
i beleive innerHTML is IE5+ only, also cf is a severside only to hide the options using cf youwould need to send the page back to the server, to do it client side you \will ned ascripting language, also if you hide the other options how can the user make a new selection if they change their mind?

in this instance i would suggest a dropdown box
<script>
      numPlans=5;
      function changeForm(strShow){
                   var strPlanId="";
                   for (var i=1;i<numPlans+1;i++){
                    strPlanId='Plan'+i;
                    document.getElementById(strPlanId).style.display='none';
                   }
        document.getElementById(strShow).style.display='block';
      </script>


<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>

you can populate the options from a query using several methods, cfselect, cfoutput query, cfloop query.

<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>
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9757283
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>
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9757801
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 !
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 9780984
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.

0

Featured Post

Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

627 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