Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script not Defined error

Status
Not open for further replies.

mercuryfrost

Technical User
Jul 26, 2010
1
IE
Hi all,

Trying to use a small bit of script to slide open and closed a div.
Copied it from another page where I have it working just fine. Coding in coldfusion.

When clicked, nothing happens, and firebug pulls an error of DC_ShowDeptStaff is undefined.

Script is:
Code:
<script type="text/javascript">
	function DC_ShowDeptStaff(){
		if( document.getElementById("testdiv").style.display=="none" ) {
			Effect.BlindDown("testdiv"); 
			 return false;
		} else {
			Effect.SlideUp("testdiv");  return false;
		}
	}
	</script>

Call is:
Code:
<a href="javascript:;" onclick="DC_ShowDeptStaff()" return false;>See All Staff in this Department</a>

Full code is:
Code:
<script type="text/javascript">
	function DC_ShowDeptStaff(){
		if( document.getElementById("testdiv").style.display=="none" ) {
			Effect.BlindDown("testdiv"); 
			 return false;
		} else {
			Effect.SlideUp("testdiv");  return false;
		}
	}
	</script>
	



<cfquery name="getStaffProfileDepartments" datasource="#ATTRIBUTES.datasource#" username="#ATTRIBUTES.username#" password="#ATTRIBUTES.password#">
SELECT		spd.staffProfileDepartmentName,
			spd.staffProfileDepartmentId
FROM		dccom_twstaffprofilesdepartments spd
WHERE		spd.instanceId		=	<cfqueryparam value = "#REQUEST.instanceId#">
		AND	spd.staffProfileDepartmentIsPublished	=	'YES'
ORDER BY	spd.staffProfileDepartmentDisplayOrder,
			spd.staffProfileDepartmentName
</cfquery>
<cfif getStaffProfileDepartments.RecordCount NEQ 0>
	<cfloop query="getStaffProfileDepartments">
		<!---INSIDE LOOP ONE--->
		<cfoutput>
			<h3>#staffProfileDepartmentName#</h3>
			<h4><a href="javascript:;" onclick="DC_ShowDeptStaff()" return false;>See All Staff in this Department</a></h4><br>
				<div class="testdiv" style="display: none"><h3>Test Success!</h3></div>
		
		
						<cfquery name="getStaffProfiles" datasource="#ATTRIBUTES.datasource#" username="#ATTRIBUTES.username#" password="#ATTRIBUTES.password#">
						SELECT		sp.staffProfileId,
									sp.staffProfileName,
									sp.staffProfilePosition,
									sp.staffProfilePhone,
									sp.staffProfileMobile,
									sp.staffProfileEmail,
									sp.staffProfileDescription,
									sp.staffProfileImage,
									sp.staffProfileDisplayOrder,
									spd.staffProfileDepartmentName,
									sp.staffProfileIsDepartmentHead,
									sp.staffProfileIsPublished
						FROM		dccom_twstaffprofiles sp	LEFT OUTER JOIN	dccom_twstaffprofilesdepartments spd 	ON	sp.staffProfileDepartmentId = spd.staffProfileDepartmentId
									AND	sp.instanceId	= 	spd.instanceId
						WHERE		sp.instanceId		=	<cfqueryparam value = "#REQUEST.instanceId#">
								AND	sp.staffProfileIsPublished	=	'YES'
								AND spd.staffProfileDepartmentId = <cfqueryparam value="#staffProfileDepartmentId#">

						ORDER BY	sp.staffProfileIsDepartmentHead DESC,
									sp.staffProfileDisplayOrder,
									sp.staffProfilePosition
									
						</cfquery>
						<cfif getStaffProfiles.RecordCount NEQ 0>
							<cfloop query="getStaffProfiles">
								<cfoutput>			
									<ul>
										<cfset cStaffProfileDescription = staffProfileDescription>		
										<cfset cStaffProfileDescription = replace(replace(cStaffProfileDescription,chr(13) & chr(10),"<br>","ALL"),chr(10),"<br>","ALL")>		
										<li>
											
											<cfif staffProfileIsDepartmentHead EQ 'YES'>
												<div class="staffInfo">
													<h3>#staffProfileName#</h3>
													<h3>DEPT HEAD</h3>
													<cfif LEN(#staffProfilePosition#)><h4>#staffProfilePosition#</h4></cfif>
													<cfif LEN(#staffProfilePosition#)><p>#cStaffProfileDescription#</p></cfif>
													<cfif LEN(#staffProfilePhone#)><p>Phone: #staffProfilePhone#</p></cfif>
													<cfif LEN(#staffProfileMobile#)><p>Mobile: #staffProfileMobile#</p></cfif>
													<cfif LEN(#staffProfileEmail#)><p><a href="mailto:#staffProfileEmail#">#staffProfileEmail#</a></p></cfif>						
												</div>
												<cfif LEN(#staffProfileImage#)>
													<div class="staffImage">
														<cfif LEN(staffProfileImage) AND fileExists(APPLICATION.siteFilePath & "contentFiles\components\twStaffProfiles\" & REQUEST.instanceId & "\" & staffProfileImage)><img src="contentFiles/components/twStaffProfiles/#REQUEST.instanceId#/#staffProfileImage#" width="100" height="120" alt="#staffProfilePosition#">
														</cfif>
													</div>
												</cfif>
											
											<cfelse>
												<h3>HIDDEN STAFF PROFILE</h3>
												<div class="staffInfo2" style="display:none" >
												<h3>#staffProfileName#</h3>
												<cfif LEN(#staffProfilePosition#)><h4>#staffProfilePosition#</h4></cfif>
												<cfif LEN(#staffProfilePosition#)><p>#cStaffProfileDescription#</p></cfif>
												<cfif LEN(#staffProfilePhone#)><p>Phone: #staffProfilePhone#</p></cfif>
												<cfif LEN(#staffProfileMobile#)><p>Mobile: #staffProfileMobile#</p></cfif>
												<cfif LEN(#staffProfileEmail#)><p><a href="mailto:#staffProfileEmail#">#staffProfileEmail#</a></p></cfif>
									
												</div>
												<cfif LEN(#staffProfileImage#)>
													<div class="staffImage">
														<cfif LEN(staffProfileImage) AND fileExists(APPLICATION.siteFilePath & "contentFiles\components\twStaffProfiles\" & REQUEST.instanceId & "\" & staffProfileImage)><img src="contentFiles/components/twStaffProfiles/#REQUEST.instanceId#/#staffProfileImage#" width="100" height="120" alt="#staffProfilePosition#">
														</cfif>
													</div>
												</cfif>
											</cfif>
										
										</li>
									</ul>
								</cfoutput>
							</cfloop>
						<cfelse>
							<cfoutput>
								<p>There are Currently No Staff Listed in this Department</p>
								<br>
							</cfoutput>
						</cfif>
						</cfoutput>
				<!---end loop one--->	
	</cfloop>
</cfif>

any input would be appreciated
 
><a href="javascript:;" onclick="DC_ShowDeptStaff()" return false;>See All Staff in this Department</a>
Try this.
[tt]<a href="javascript:[blue]void(0)[/blue];" onclick="DC_ShowDeptStaff()[highlight]">[/highlight]See All Staff in this Department</a>[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top