Results 1 to 4 of 4
-
3rd Sep 2010, 02:53 PM #1OPMemberWebsite's:
maxneeds.info[JS] indexof prob
Hi !
I have the following function :
Code:<script>function hide(){ var str=document.location.href; if(str.indexOf(\"?to=\")) {document.getElementById('vip').style.display='none';} }</script>
But this one is hiding it always.
Any help ?Porsche_maniak Reviewed by Porsche_maniak on . [JS] indexof prob Hi ! I have the following function : <script>function hide(){ var str=document.location.href; if(str.indexOf(\"?to=\")) {document.getElementById('vip').style.display='none';} }</script> I am trying to hide an object if in the url contains '?to=' . But this one is hiding it always. Rating: 5
-
3rd Sep 2010, 05:34 PM #2MemberWebsite's:
Elite.SO Defendos.com Motionite.comThis is a small code that I use in my templates to show/hide something.
Save this file as "slide.js"
Code:////////////////////////////////////////////////////////////////////////////// // slide.js Example ////////////////////////////////////////////////////////////////////////////// var Hide = ""; var varHt = 0; var Ht = ""; var x = 0; var y = 10; var z = 4; var foo = new Array(); var Speed = ""; function setup() { foo = document.getElementsByTagName("div"); for (i=0;i<foo.length;i++) { if (foo[i].className == "hidden") { Hide = foo[i].id; } } Ht = document.getElementById(Hide).offsetHeight; Speed = Hide.substring(Hide.lastIndexOf('-')+1); document.getElementById(Hide).style.height = '0px'; document.getElementById('toggle').style.display = 'inline'; if (Speed == 1) { y = 100; z = 1; } if (Speed == 2) { y = 70; z = 1; } if (Speed == 3) { y = 40; z = 1; } if (Speed == 4) { y = 20; z = 1; } if (Speed == 5) { y = 10; z = 1; } if (Speed == 6) { y = 10; z = 2; } if (Speed == 7) { y = 10; z = 4; } if (Speed == 8) { y = 10; z = 7; } if (Speed == 9) { y = 10; z = 10; } } function toggle() { if (x === 0) { document.getElementById(Hide).style.height = varHt+'px'; if (((Ht-varHt) < z) && (varHt !== Ht)) { varHt = Ht; } else { varHt = varHt+z; } if (varHt <= Ht) { setTimeout('toggle()',y); } if (varHt > Ht) { varHt = Ht; x = 1; } } else { document.getElementById(Hide).style.height = varHt+'px'; varHt = varHt-z; if ((Ht-varHt) <= Ht) { setTimeout('toggle()',y); } if ((Ht-varHt) > Ht) { varHt = 0; document.getElementById(Hide).style.height = varHt+'px'; x = 0; } } }
Code:<script type="text/javascript" src="menu.js"></script>
Code:<a href="#" id="toggle" onclick="toggle();"><strong>Show/Hide</strong></a> <div id="hidden" class="hidden"> echo "text here, this will be hidden, after you click Show/Hide it will show up." </div>
-
3rd Sep 2010, 06:16 PM #3MemberWebsite's:
litewarez.net litewarez.com triniwarez.comCode:function _$(id){return document.getElementById(id) || undefined;} var a_uri = document.location.href || ''; if(a_uri.indexOf("?to=")) { elem = _$('vip'); if(elem != undefined) { elem.style.display = 'none' } }
Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
-
3rd Sep 2010, 08:37 PM #4OPMemberWebsite's:
maxneeds.infoThanks litewarez i already solved it with
Code:<script type=text/javascript>function hide(){if (document.location.href.indexOf('?to=') >= 0){document.getElementById('vip').style.display='none';}}hide();</script>
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
help me plz dle prob
By fahadzaman66 in forum Webmaster DiscussionReplies: 10Last Post: 15th Oct 2011, 02:12 AM -
ipb seo 1.1 prob
By FSL in forum IP.BoardReplies: 12Last Post: 25th May 2011, 04:48 PM -
RL Mtn prob
By Chris2k in forum Technical Help Desk SupportReplies: 1Last Post: 10th Jan 2011, 12:53 AM -
Prob With my PC :| (Help!!)
By vizoomer in forum Technical Help Desk SupportReplies: 19Last Post: 12th Aug 2010, 07:32 AM -
CSS IE6 prob
By Porsche_maniak in forum Web Development AreaReplies: 1Last Post: 5th Jun 2010, 10:06 AM
themaCreator - create posts from...
Version 3.46 released. Open older version (or...