javascript - Changing the default tab and page with js -


i beginner web design. need professionals me solve problem.

underneath js using create tabs. change default tab, still couldn't figure out how change default tab page. please !!!

<script type="text/javascript"> //<![cdata[  var tablinks = new array(); var contentdivs = new array();  function init() {    // grab tab links , content divs page   var tablistitems = document.getelementbyid('tabs').childnodes;   ( var = 0; < tablistitems.length; i++ ) {     if ( tablistitems[i].nodename == "li" ) {       var tablink = getfirstchildwithtagname( tablistitems[i], 'a' );       var id = gethash( tablink.getattribute('href') );       tablinks[id] = tablink;       contentdivs[id] = document.getelementbyid( id );     }   }    // assign onclick events tab links, ,   // highlight first tab   var = 0;    ( var id in tablinks ) {     tablinks[id].onclick = showtab;     tablinks[id].onfocus = function() { this.blur() };     if ( == 0 ) tablinks["order"].classname = 'selected';     i++;   }    // hide content divs except first   var = 0;    ( var id in contentdivs ) {   if ( != 0 ) contentdivs[id].classname = 'tabcontent hide';     i++;   } }  function showtab() {   var selectedid = gethash( this.getattribute('href') );    // highlight selected tab, , dim others.   // show selected content div, , hide others.   ( var id in contentdivs ) {     if ( id == selectedid ) {       tablinks[id].classname = 'active';       contentdivs[id].classname = 'tabcontent';     } else {       tablinks[id].classname = '';       contentdivs[id].classname = 'tabcontent hide';     }   }    // stop browser following link   return false; }  function getfirstchildwithtagname( element, tagname ) {   ( var = 0; < element.childnodes.length; i++ ) {     if ( element.childnodes[i].nodename == tagname ) return element.childnodes[i];   } }  function gethash( url ) {   var hashpos = url.lastindexof ( '#' );   return url.substring( hashpos + 1 ); }  //]]> </script> 

this list of tabs

<ul id="tabs">       <li><a href="#features">product features</a></li>       <li><a  class="selected" href="#order">order unify sutures</a> </li>       <li><a href="#spec">specifications</a></li>         <li><a href="#testi">testimonials</a></li>         <li><a href="#overview">suture overview</a></li>        </ul> 

change code here

// hide content divs except first var = 0;  ( var id in contentdivs ) {     if ( != 0 ) contentdivs[id].classname = 'tabcontent hide';     i++; } 

the 0 in if clause if ( != 0 ) defines active tab page.

@ jquery ui tabs want , easy use.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -