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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now