473,326 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

show/hide problem with explorer 7

Hi all,

I have been trying to use a show / hide script on my web site but when
I click on the "hide" button there occurs an error with explorer 7.
The web site starts to go down =) and there happens a blank on the top
of the page. the problem occurs when I use the codes more than one
content and when I add new contents with the codes below, the blanks
is getting greater =)

* I built my web sites on "joomla" open source content management
software.

<b>The codes I have tried between head tags are </b>

<script type=”text/javascript”>
function shToggle(content) {
if (document.getElementById(content).style.display == “none”)
document.getElementById(content).style.display = “block”
else
document.getElementById(content).style.display = “none”
}
</script>
<b>and I used that one in my each content </b>

<span>What’s the name of Calgary’s NHL Team?</span>
<a href=”javascript:void(0);” onclick=”shToggle(’calgary’); return
false;”>show/hide answer</a>

<div id=”calgary” style=”display:none;”>The Calgary Flames</div>

You can check the images of the web site here :
http://forum.joomla.org/viewtopic.php?f=32&t=341625 I have also post
the problem on joomla forum but I think it's about coding.
Nov 8 '08 #1
17 2188
SAM
Le 11/8/08 7:23 AM, may bailey a écrit :
* I built my web sites on "joomla" open source content management
software.
Nothing in this code calls something about joomla.
<script type=”text/javascript”>
function shToggle(content) {
if (document.getElementById(content).style.display == “none”)
document.getElementById(content).style.display = “block”
else
document.getElementById(content).style.display = “none”
}
</script>
function shToggle(content) {
var d = document.getElementById(content).style;
d.display = d.display=='none'? 'block' : 'none';
return false;
}
<span>What’s the name of Calgary’s NHL Team?</span>
<a href=”javascript:void(0);” onclick=”shToggle(’calgary’); return
false;”>show/hide answer</a>
take care to use correct quotes : " and ' instead of ” and ’

<p><a href="#" onclick="return shToggle('calgary');">show/hide
answer</a></p>

<div id=”calgary” style=”display:none;”>The Calgary Flames</div>
<p id="calgary" style="display:none">voir ou non</p>

--
sm
Nov 8 '08 #2
SAM
Le 11/8/08 10:40 AM, SAM a écrit :
Le 11/8/08 7:23 AM, may bailey a écrit :

take care to use correct quotes : " and ' instead of ” and ’


CSS :
=====

#quizz span { display: none; }
#quizz .answer span { display: inline; color: red }

JS :
====
function toggle(what) {
what.className = what.className==''? 'answer' : '';
}

HTML :
======
<h3>quizz</h3>
<ul id="quizz" title="click to show or hide answer">
<li onclick="toogle(this);">
question #1 : <span>answer 1</span></li>
<li onclick="toogle(this);">
question #2 : <span>answer 2</span></li>
<li onclick="toogle(this);">
question #3 : <span>answer 3</span></li>
</ul>
--
sm
Nov 8 '08 #3
Hi again,

Thanks for your help but it didnt solve the problem.

I my codes with your new codes but I got the same error =( By the way
the marks (") that you wanted me to take care of seems ok in my site.

By the way, there is nothing related to joomla with the codes I wrote.
I just wanted to give enough informations about my problem.

There was a question mark in your codes for <script>..., what was that
for?

regards
Nov 8 '08 #4
SAM
Le 11/8/08 11:23 AM, may bailey a écrit :
Hi again,

Thanks for your help but it didnt solve the problem.
does that here :
<http://cjoint.com/?lim1tfDaan>
work for you ?
There was a question mark in your codes for <script>..., what was that
for?
Not understood.
what about do you talk?
I did correct your function (more simple and faster)
I did correct your html link :

- href="javascript:void()"
is the most uggly way to code a link with a JS event
At least put : href="#"
and prefer to give an url to a page for those browsing without JS.
To stop the call to html link (href) add : return false;
in the onclick

Another example of toggle :
<http://cjoint.com/?lingA6DNtO>

Method with css rollover on links :
<http://cjoint.com/?linoIBJCOn>
(and without JS)

--
sm
Nov 8 '08 #5
On Nov 8, 4:23*am, may bailey <maybai...@gmail.comwrote:
There was a question mark in your codes for <script>..., what was that
for?

regards
http://en.wikipedia.org/wiki/Conditional_operator
Nov 8 '08 #6
SAM
Le 11/8/08 1:18 PM, SAM a écrit :
Le 11/8/08 11:23 AM, may bailey a écrit :
>There was a question mark in your codes for <script>..., what was that
for?

d.display = d.display=='none'? 'block' : 'none';

translation :
d.display is, if d.display is 'none', 'block' else it is 'none'
same as :

d.display = (d.display=='none')? 'block' : 'none';

or :

if(d.display == 'none' ) d.display = 'block';
else d.display = 'none';

or :

if ( d.display == 'none' )
{
d.display = 'block';
}
else
{
d.display = 'none';
}

var displayed = d.display=='none'; // true/false

if(displayed) d.display = 'block'; else d.display = 'none';

d.display = displayed? 'block' : 'none';
--
sm
Nov 8 '08 #7
Thanks for the detailed answers.

Unfortunately the problem is still going on for explorer 7. I would
like to give the url of the page so maybe you can understand the
reason and we can find a solution??

the url of the page : http://emlaxity.com/main/content/blogcategory/14/28/#

you will see the hide / show option by every content.

Regards
Nov 8 '08 #8
SAM
Le 11/8/08 3:09 PM, may bailey a écrit :
Thanks for the detailed answers.

Unfortunately the problem is still going on for explorer 7. I would
like to give the url of the page so maybe you can understand the
reason and we can find a solution??

the url of the page : http://emlaxity.com/main/content/blogcategory/14/28/#

you will see the hide / show option by every content.
All I can say is that works in my Fx.3 (Mac) and my IE.6 (Win XP)

I haven't IE.7

You're working in XHTML and that doc-type supports no error of coding.

Unlovely I see :

<style type="text/css">
</style>
<script type="text/javascript">
function shToggle(content) {
var d = document.getElementById(content).style;
d.display = d.display=='none'? 'block' : 'none';
return false;
}

</script>

which is not in the head
And My Firefox sees 60 errors ...
What does the validator tell about this page ?
<http://validator.w3.org/check?uri=http%3A%2F%2Femlaxity.com%2Fmain%2Fconte nt%2Fblogcategory%2F14%2F28%2F>

--
sm
Nov 8 '08 #9
SAM
Le 11/8/08 11:56 PM, SAM a écrit :
Le 11/8/08 3:09 PM, may bailey a écrit :
>>
the url of the page :
http://emlaxity.com/main/content/blogcategory/14/28/#

I haven't IE.7
I got it and did install it.

That works fine !

--
sm
Nov 8 '08 #10
Thanks again for your interest.

Are you sure that that works fine? But I still see the same problem is
going on =( When I click the "hide" button after showing the content,
the page is going down on explorer 7.

By the way the script code was between the head tags but I tried to
put it in every content at the time of your check. But now it's ok.

P.S: I saw the validaor results which seems terrifiying as always for
me =) but I dont know how to fix them beacuse when I check my
index.html I cannot see any kind of errors as I see with validator and
I Think it's because of my poor understanding of the warnings, because
whenever I try to fix them as I see on validator page, the result
never changes.

Regards
Nov 9 '08 #11
SAM
Le 11/9/08 9:07 AM, may bailey a écrit :
Thanks again for your interest.

Are you sure that that works fine? But I still see the same problem is
going on =( When I click the "hide" button after showing the content,
the page is going down on explorer 7.
going down ?

Of course the content is smaller so the window can scroll to adapt the
viwer to the new cintent, no ?

try with url :
http://emlaxity.com/main/content/blogcategory/14/28/
instead of :
http://emlaxity.com/main/content/blogcategory/14/28/#
P.S: I saw the validaor results which seems terrifiying as always for
me =)
This validator isn't very friendly.

but I dont know how to fix them beacuse when I check my
index.html I cannot see any kind of errors as I see with validator and
I Think it's because of my poor understanding of the warnings, because
whenever I try to fix them as I see on validator page, the result
never changes.
I did try to see ...
it's quite impossible : too much tables (whom a lot being nested) and
divs not always necessary.

You could begin by choosing an easier doctype as html4.01
without xml

--
sm
Nov 9 '08 #12
On 9 Kasým, 17:25, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
Le 11/9/08 9:07 AM, may bailey a écrit :
Thanks again for your interest.
Are you sure that that works fine? But I still see the same problem is
going on =( When I click the "hide" button after showing the content,
the page is going down on explorer 7.

going down ?

Of course the content is smaller so the window can scroll to adapt the
viwer to the new cintent, no ?

try with url :http://emlaxity.com/main/content/blogcategory/14/28/
instead of :http://emlaxity.com/main/content/blogcategory/14/28/#
Yes unfortunately it's going down to adapt the viewer to the new
content but why? It's a problem for me and there is not a problem with
firefox or explorer 6, but I need to fix it for explorer 7 which is
widely used =( Cant we fix it? and if yes, how?

regards
Nov 9 '08 #13
Hi again,

Doesnt anyone has a solution for this problem?

regards
Nov 12 '08 #14
may bailey wrote:
Doesnt anyone has a solution for this problem?
<http://jibbering.com/faq/#noAnswer>
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Nov 12 '08 #15
On Nov 13, 12:02*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
may bailey wrote:
Doesnt anyone has a solution for this problem?

<http://jibbering.com/faq/#noAnswer>

PointedEars
--
* * realism: * *HTML 4.01 Strict
* * evangelism: XHTML 1.0 Strict
* * madness: * *XHTML 1.1 as application/xhtml+xml
* * * * * * * * * * * * * * * * * * * * * * * * * * -- Bjoern Hoehrmann
Thanks a lot

I changed it with XHTML 1.1 which you called madness ; )

Regards
may
Nov 15 '08 #16
On Nov 15, 9:48*am, may bailey <maybai...@gmail.comwrote:
On Nov 13, 12:02*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
may bailey wrote:
Doesnt anyone has a solution for this problem?
<http://jibbering.com/faq/#noAnswer>
PointedEars
--
* * realism: * *HTML 4.01 Strict
* * evangelism: XHTML 1.0 Strict
* * madness: * *XHTML 1.1 as application/xhtml+xml
* * * * * * * * * * * * * * * * * ** * * * * * * * -- Bjoern Hoehrmann

Thanks a lot

I changed it with XHTML 1.1 which you called madness ; )
Why on earth would you do that? Scratch "XHTML" out of your
playbook. And 1.1 on the Web is madness, as is 1.0 when served as
text/html. Yes, lots of pinheads do it (including whomever is
responsible for the W3C site, which is cutting edge for 1999.) If
they all jumped off a bridge...
Nov 19 '08 #17
On Nov 8, 9:09*am, may bailey <maybai...@gmail.comwrote:
Thanks for the detailed answers.

Unfortunately the problem is still going on for explorer 7. I would
like to give the url of the page so maybe you can understand the
reason and we can find a solution??

the url of the page :http://emlaxity.com/main/content/blogcategory/14/28/#
Sorry, I don't trust IE7 (or people with lowercase names.)
>
you will see the hide / show option by every content.
Nope. Post the entire script here if you want help. But frankly,
after reading your posts in this thread, the best advice is to pack it
in.
Nov 19 '08 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Thomas Abraham | last post by:
Hi, The following code to show and hide a row works fine in netscape 7 and IE 6. But everytime the cell is hidden and displayed in netscape, it adds a new line inside the cell. Please advise....
3
by: Sam | last post by:
I wrote a script to show or hide items in an HTML list (<ul id="stuff">) depending on whether a list-item's CLASS attribute matches an input string (catString), which is chosen from a SELECT menu....
0
by: Benny Raymond | last post by:
I just wanted to figure out a way to have a list view work like the microsoft explorer list view, so I could show/hide columns with a right click - anyone know the best way of going about this? ...
7
by: Larry Woods | last post by:
I don't see the pattern. I have a couple of solutions that I acquired from someone else. When I load these, I see the .vbproj and .vbproj.user files in the Solution Explorer. BUT, when I create...
0
by: christie.sorenson | last post by:
Hi, I have created an explorer band object using C# (with the great help of http://www.codeproject.com/csharp/dotnetbandobjects.asp ) I'm trying to make the explorer bar hide or resize to a...
5
by: ali | last post by:
Hello every one i need you help regarding div hide and show. i am having a link like <a href="#" onClick="expandWin()">show/hide </a> <div id=showHide> </div> within div i have lots of...
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
1
by: pamate | last post by:
hi, I want to show hide layers. I am able to show and hide layers but i am facing problem that, cant view the cursor in Mozilla,but i can type in input text box, its overlapping the layers. ...
1
oranoos3000
by: oranoos3000 | last post by:
hi would you please help me i have a online shopping center that i show pictures of the my product in home page. in the InterExplorer pictures is shown correctly but in Firefox browser is shown...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.