Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

TABS work in IE but need firefox substitution

Posted on 2006-05-30
5
Medium Priority
?
402 Views
Last Modified: 2008-01-09
http://versatilesheds.com/
doesnt work in firefox is there some substitution for ff version 1 or higher?

i wouldnt want ff users to get frustrated when viewing my site?
0
Comment
Question by:aot2002
  • 3
5 Comments
 
LVL 4

Expert Comment

by:Kokoglen
ID: 16791487
Some different Javascript tabs sites:

http://javascript.internet.com/navigation/tab-control-simulation.html (Free)
http://www.dynarch.com/products/dhtml-tabs/ ($20) - nice slide effect
http://www.apycom.com/navigation-bar-tabs/ex2.html (Free)
http://www.zapatec.com/website/main/products/tabs/index.jsp ($60) - uses AJAX to fill the inner area.

All of these seem to work on FF.
0
 
LVL 1

Author Comment

by:aot2002
ID: 16791906
is it possible to subsitute a fix i mean for my tabs setup?

i dont want to rebuild new tab system
0
 
LVL 17

Accepted Solution

by:
gops1 earned 2000 total points
ID: 16792376
You are is using window.event.srcElement which will not work in any other than IE. Check this code pated below. Check it out undersatnd and follow the same in your code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
      <head>
      <title>Untitled Document</title>
      <script type="text/javascript">
            function clickHandle(evt) {
                  var evt = evt || window.event; // event object
                  var target = evt.target || window.event.srcElement; // event target
                  var targetID = target.getAttribute("id"); // event target id

                  alert(targetID);
            }

            /* dynamically assign events */
            window.onload = function() {
                  document.getElementById("myA").onclick = clickHandle; // just set onclick handler
                  document.getElementById("myDiv").onclick = function(evt) { // set onclick event via anonymous function
                        clickHandle(evt)
                  };
            }
</script>
</head>

<body>
      <span id="mySpan" onclick="clickHandle(event);">This is mySpan</span><br><br>
      <a id="myA">This is myA</a><br><br>
      <div id="myDiv">This is myDiv</div>
</body>
</html>

Hope this helps.
0
 
LVL 1

Author Comment

by:aot2002
ID: 16793189
im getting a headache from this !!!!!
--------------------------------------------



 
            if (window.event){
                  //works in IE only
                 
      if(window.event.srcElement.className == "tab"){

            currentTab.className = "tab";

            tabBase.style.backgroundColor = "";
     
            currentTab = window.event.srcElement;

    tabBaseID = currentTab.id + "base";

            tabContentID = currentTab.id + "Contents";

            tabBase = document.all(tabBaseID);

            tabContent = document.all(tabContentID);

            currentTab.className = "selTab";
            
            tabBase.style.backgroundColor = "#D6D3CE";

            tabContents.innerHTML = tabContent.innerHTML;
            

      }
      
      }else{
                  
            //FIREFOX  
      
                  function clickHandle(evt) {
               var evt = evt || window.event; // event object
               var target = evt.target || window.event.srcElement; // event target
               var targetID = target.getAttribute("id"); // event target id
                                          
               alert(targetID);
          }

       /* dynamically assign events */
       window.onload = function() {
               //document.getElementById("myA").onclick = clickHandle; // just set onclick handler
               document.getElementById("t1").onclick = function(evt) { // set onclick event via anonymous function
                    clickHandle(evt)
               };
       }
       
    currentTab.className = "tab";

            tabBase.style.backgroundColor = "";
         
         var evt = window.event; // event object
         var target = evt.target; // event target
            currentTab = target.getAttribute("id");;

    tabBaseID = currentTab.id + "base";

            tabContentID = currentTab.id + "Contents";

            tabBase = document.all(tabBaseID);

            tabContent = document.all(tabContentID);

            currentTab.className = "selTab";
            
            tabBase.style.backgroundColor = "#D6D3CE";

            tabContents.innerHTML = tabContent.innerHTML;
            
      }
      
}
0
 
LVL 1

Author Comment

by:aot2002
ID: 16794852
help here anyone
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

564 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