Dave,

You're basically using the Dreamweaver code--which is crap. (Pardon the
language.)

Anyway, I suspect the reason it's failing is because you're passing in an
object to the "pv" function, but the "typeof" operator is not seeing at as
"object" but as an "htmlElementNode" or something like that. That would
cause an error.

Try putting the following line at the top of the pv function:

alert(typeof obj);

and see what it returns. My guess is it's returning something other than
"object"--which is cause the condition to fail. To correct the problem, I'd
just change the line from:

        if(typeof(obj)!='object'){var obj=document.getElementById(obj);}

to:

        if(typeof(obj)=='string'){var obj=document.getElementById(obj);}

The bottom line is if the "obj" variable is anything other than a string,
the getElementById() statement would fail anyway. There's only two types of
things that should be passed to that function anyway: a string contain the
ID of an element to get or a reference to the actual element--everything
else would cause errors.

-Dan

>-----Original Message-----
>From: Dave Lyons [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, October 03, 2006 2:49 AM
>To: CF-Talk
>Subject: js problem in safari
>
>the following code works in pretty much all the browsers except Safari. All
>it is a show/hide layers on link click, anyone have any suggestions?
>
><cfsavecontent variable="showjs">
><cfoutput>
><script type="text/JavaScript">
><!--
>function pv(obj,cP,jP){
>       if(typeof(obj)!='object'){var obj=document.getElementById(obj);}
>       if(typeof(obj.currentStyle)!='object'){
>               return (typeof(document.defaultView)=='object')?
>
>       document.defaultView.getComputedStyle(obj,'').getPropertyValue(cP):
>               obj.style.getPropertyValue(cP);}
>       else{
>               return (navigator.appVersion.indexOf('Mac')!=-1)?
>               obj.currentStyle.getPropertyValue(cP):
>               obj.currentStyle.getAttribute((jP)?jP:cP);}
>}
>
>function toggleIt(){
>       var
>obj,cS,args=toggleIt.arguments;document.MM_returnValue=(typeof(args[0].href
>)!='string')?true:false;
>       for(var i=1;i<args.length;i++){obj=document.getElementById(args[i]);
>               if(obj){cS=pv(obj,'display');
>
>
if(!obj.jw_OD){obj.jw_OD=(cS!='none'&&cS!='')?cS:(obj.tagName.toUpper
>Case()=='TR' && cS!=='none')?'':
>                       (obj.tagName.toUpperCase()=='TR' &&
>typeof(obj.currentStyle)!='object')?'table-row':'block';}
>                       obj.style.display=(cS!='none')?'none':obj.jw_OD}}
>}
>//-->
></script>
></cfoutput>
></cfsavecontent>
>
><cfhtmlhead text="#showjs#">
>
><cfloop query="getFaqs">
>               <cfif not isdefined("thisCount")>
>               <cfset thisCount = 1>
>               <cfelse>
>               <cfset thisCount = thisCount + 1>
>               </cfif>
>
>               <p class="pcenter"><a href="javascript:;"
>onclick="toggleIt(this,'sh#thisCount#');return
>document.MM_returnValue">#getFaqs.jtbl_question#</a><br /><span
>id="sh#thisCount#" style="display:none;">#getFaqs.jtbl_answer#</span></p>
></cfloop>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255137
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to