Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 01-02-2008, 03:50 PM FireFox Issue
kline11's Avatar
SearchBliss Web Tools

Latest Blog Post:
Oracle Embraces the Cloud
Posts: 1,724
Name: John
Location: USA
Trades: 0
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>
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Last edited by kline11; 01-02-2008 at 03:53 PM..
kline11 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-02-2008, 07:46 PM Re: FireFox Issue
kline11's Avatar
SearchBliss Web Tools

Latest Blog Post:
Oracle Embraces the Cloud
Posts: 1,724
Name: John
Location: USA
Trades: 0
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!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
kline11 is offline
Reply With Quote
View Public Profile
 
Old 01-03-2008, 01:17 PM Re: FireFox Issue
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to FireFox Issue
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.11972 seconds with 12 queries