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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Time Sheet Help 6 55
WSUS Client Issues 52 1,637
How to move and access a folder outside of the root folder 4 85
How can i point a subdomain to directory? 5 19
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

776 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