Reply
FireFox Issue
Old 01-02-2008, 02:50 PM FireFox Issue
kline11's Avatar
King Spam Talker

Latest Blog Post:
Google Chrome web browser
Posts: 1,273
Name: John
Location: USA
I am having an issue with firefox and show-hide layers. It just won't work in FF and it's making me crazy. Is there an easy fix with the code?

Here is the javascript generated by Dreamweaver:
Code:
<script language="JavaScript">
function getCookie(NameOfCookie){
    if (document.cookie.length > 0) {
    begin = document.cookie.indexOf(NameOfCookie+"=");
    if (begin != -1) {
      begin += NameOfCookie.length+1;
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
        return unescape(document.cookie.substring(begin, end));
    }
  }
  return null;
} 

function setCookie(NameOfCookie, value, expiredays) {
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000)); 

  document.cookie = NameOfCookie + "=" + escape(value) +
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
} 

function delCookie (NameOfCookie) {
  if (getCookie(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
} 

function checkIt()
{
 visited=getCookie('visited');
  if (visited==null)
 {
setCookie('visited','yes',180)
Hide('L1','','hide')
 }
}
</script>
<script language="JavaScript">
<!--
function GetObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=GetObj(n,d.layers[i].document); return x;
}

function Hide() {
  var i,p,v,obj,args=Hide.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=GetObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v;
   setTimeout("Show('L1','','show')", 3000);
		}
}

function MyObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MyObj(n,d.layers[i].document); return x;
}

function Show() {
  var i,p,v,obj,args=Show.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MyObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v;
 }
}
function NewObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=NewObj(n,d.layers[i].document); return x;
}

function HideIt() {
  var i,p,v,obj,args=HideIt.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=GetObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v;
		}
}

//-->
</script>
__________________
SearchBliss Web Tools

Last edited by kline11 : 01-02-2008 at 02:53 PM.
kline11 is offline
Reply With Quote
View Public Profile Visit kline11's homepage!
 
When You Register, These Ads Go Away!
     
Old 01-02-2008, 06:46 PM Re: FireFox Issue
kline11's Avatar
King Spam Talker

Latest Blog Post:
Google Chrome web browser
Posts: 1,273
Name: John
Location: USA
To make things easier, I would appreciate it greatly if someone with Dreamweaver (above version 3) could create a show/hide layer using onClick, then just post me the javascript code. I know later versions of Dreamweaver are compatible with FireFox, I just can't afford a new version at this time. Thanks!
__________________
SearchBliss Web Tools
kline11 is offline
Reply With Quote
View Public Profile Visit kline11's homepage!
 
Old 01-03-2008, 12:17 PM Re: FireFox Issue
chrishirst's Avatar
Super Moderator

Posts: 12,818
Location: Blackpool. UK
you don't need DW to create javascript functions at all.

I find it much quicker and get FAR more efficient code to write from something scratch.

Code:
function toggle(eleID) {
var e = document.getElementById(eleID).style;
     if (e.display == "block") {
         e.display = "none";
         e.visibility = "hidden";
     } else {
         e.display = "block";
         e.visibility = "visible";
      }
}
Not tested BTW just bashed out at the keyboard.

to use = onclick="toggle("elementID");"
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to FireFox Issue
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12463 seconds with 13 queries