inherit
159666
0
Oct 14, 2015 23:11:26 GMT -8
Piccadilly
62
October 2010
piccadilly
|
Post by Piccadilly on May 26, 2011 7:31:21 GMT -8
Hi! I have been using this kind of javascript on my site: <script language=javascript type='text/javascript'> function hideDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideshow').style.visibility = 'hidden'; } else { if (document.layers) { // Netscape 4 document.hideshow.visibility = 'hidden'; } else { // IE 4 document.all.hideshow.style.visibility = 'hidden'; } } }
function showDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideshow').style.visibility = 'visible'; } else { if (document.layers) { // Netscape 4 document.hideshow.visibility = 'visible'; } else { // IE 4 document.all.hideshow.style.visibility = 'visible'; } } }
</script> I have been wondering if it is possible to set the values so that the div content this code is affecting would be hidden at first, and THEN it shoud be clicked to be shown. I took this code from there: www.webmasterworld.com/forum91/441.htm...And because that thread is so old, I thought that maybe someone in here would help me. I'm sorry for my bad english. -Piccadilly
|
|
inherit
23506
0
Nov 19, 2012 5:30:35 GMT -8
James [a_leon]
I feel a strong desire to XSS a cookie from Peter.
4,334
April 2004
mnstrgarge
|
Post by James [a_leon] on May 27, 2011 7:55:21 GMT -8
You would just add style="display:none;" to the div tag.
So instead of <div id="hideshow">
It would be this <div id="hideshow" style="display:none;">
Also, there's a nicer way to do that where you only need one link that will change its text whether or not it's hidden or displayed. If you'd like, I can write that up for you.
|
|
inherit
159666
0
Oct 14, 2015 23:11:26 GMT -8
Piccadilly
62
October 2010
piccadilly
|
Post by Piccadilly on May 27, 2011 8:19:34 GMT -8
Thanks a lot for your help! The div doesn't appear at first witch is just as I wanted it to be. BUT now I have a new problem.. The div doesn't show up after klicked the ''show chat'' button. This is the site I'm working on: riimusudet.net/risuchat.htmlShow chat / hide chat buttons are on the right. And yeah I would rly appreciate that, if u just won't mind. : D
|
|
inherit
23506
0
Nov 19, 2012 5:30:35 GMT -8
James [a_leon]
I feel a strong desire to XSS a cookie from Peter.
4,334
April 2004
mnstrgarge
|
Post by James [a_leon] on May 29, 2011 11:14:00 GMT -8
I haven't forgotten about this. I've just been busy. I will get this written up today, though.
|
|
inherit
23506
0
Nov 19, 2012 5:30:35 GMT -8
James [a_leon]
I feel a strong desire to XSS a cookie from Peter.
4,334
April 2004
mnstrgarge
|
Post by James [a_leon] on May 29, 2011 19:18:58 GMT -8
New script:
<script type="text/javascript"> // <![CDATA[
function hideShow () { if (document.getElementById ("hideshow").style.display.match(/none/i)) { document.getElementById ("hideshowlink").innerHTML = "Click to hide"; document.getElementById ("hideshow").style.display = ""; } else { document.getElementById ("hideshowlink").innerHTML = "Click to show"; document.getElementById ("hideshow").style.display = "none"; } }
// ]]> </script>
Your div will now have to be this...
<div id="hideshow" style="display:none;">
And your link will be this.
<a href="#" onclick="hideShow()" id="hideshowlink">Click to show</a>
|
|
inherit
159666
0
Oct 14, 2015 23:11:26 GMT -8
Piccadilly
62
October 2010
piccadilly
|
Post by Piccadilly on Jun 10, 2011 0:36:36 GMT -8
Oh sorry, I hadn't noticed that u had already answered to this! Thanks a lot for your time and help, I'll definitely use that code on my site. )
|
|