|
| Re: javascript deficient |
 |
Fri, 29 Dec 2006 23:15:04 -060 |
> onclick="showhideDiv(divImage2)"
I'm going to take a wild stab at this. I don't know much about JS, but
do have some experience in other languages. I'm guessing that you might
need single quotes around divImage2 so this section would read:
onclick="showhideDiv('divImage2')"
Again, I don't know JS, this is only a guess...
John
|
| Post Reply
|
| javascript deficient |
 |
Fri, 29 Dec 2006 23:59:28 -050 |
Once again I have to rely on others who have taken the time to learn
javascript....I'll get there some day. :-\
I'm redesigning a site and the javascript used on one of the pages -
http://www.horntek.com/zcom.asp?pg=products&grp=600 - does not work in
Firefox (and possibly other browsers) if I include a doctype. Take the
doctype out and it works great. It does work my version of IE.
The js works fine in the old version of the site where there is no doctype -
http://www.votawtool.com/zcom.asp?pg=products&grp=600
The function is:
function showhideDiv(theItem)
{
if (typeof(theItem) != "undefined")
{
if (theItem.style.display == 'none')
theItem.style.display = 'block'
else
theItem.style.display = 'none';
}
}
And it's used here:
<img src="/graphics/4arrow4.gif" id="Image2"
onMouseOver="MM_swapImage('Image2','','/graphics/4arrow2.gif',1)"
onMouseOut="MM_swapImgRestore()"
onclick="showhideDiv(divImage2)"
style="cursor: hand" alt="">
to hide and show this div:
<div id="divImage2" style="display: none;"><table
width="100%" border="0"
cellspacing="0" cellpadding="2"
bgcolor="#DBE2EC"><tr><td
width="300"><img
src="/img/products/2550C1smC.jpg" vspace=2 hspace=2 border=0
alt=""></td><td
class="main-small"><A
HREF="zcom.asp?pg=products&specific=jnrqorg4">click here
for
details...</a></td></tr></table></div>
I'm getting the error, "divImage2 is not defined" for the onclick.
Can any of you js gurus help?
Thanks,
Mickey
|
| Post Reply
|
| Re: javascript deficient |
 |
Sat, 30 Dec 2006 03:03:41 -050 |
Mickey wrote:
> The function is:
>
> function showhideDiv(theItem)
> {
> if (typeof(theItem) != "undefined")
> {
> if (theItem.style.display == 'none')
> theItem.style.display = 'block'
> else
> theItem.style.display = 'none';
> }
> }
>
function showhideDiv(theItem){var x;
if(x=document.getElementById(theItem)){
x.style.display=x.style.display=='none'?'':'none';
}
}
onclick="showhideDiv('divImage2')"
Mick
> <img src="/graphics/4arrow4.gif" id="Image2"
>
onMouseOver="MM_swapImage('Image2','','/graphics/4arrow2.gif',1)"
> onMouseOut="MM_swapImgRestore()"
onclick="showhideDiv(divImage2)"
> style="cursor: hand" alt="">
>
>
> to hide and show this div:
>
> <div id="divImage2" style="display:
none;"><table width="100%" border="0"
> cellspacing="0" cellpadding="2"
bgcolor="#DBE2EC"><tr><td
width="300"><img
> src="/img/products/2550C1smC.jpg" vspace=2 hspace=2 border=0
alt=""></td><td
> class="main-small"><A
> HREF="zcom.asp?pg=products&specific=jnrqorg4">click
here for
> details...</a></td></tr></table></div>
>
> I'm getting the error, "divImage2 is not defined" for the
onclick.
>
> Can any of you js gurus help?
>
> Thanks,
> Mickey
>
>
|
| Post Reply
|
| Re: javascript deficient |
 |
Sat, 30 Dec 2006 07:43:34 -050 |
That's the ticket. THANK YOU MICK!!!!!!!
Mickey
"Mick White" <web@mickweb.com> wrote in message
news:BODKfl%23KHHA.1320@ns1.xroubaix.com...
> Mickey wrote:
>
>> The function is:
>>
>> function showhideDiv(theItem)
>> {
>> if (typeof(theItem) != "undefined")
>> {
>> if (theItem.style.display == 'none')
>> theItem.style.display = 'block'
>> else
>> theItem.style.display = 'none';
>> }
>> }
>>
>
> function showhideDiv(theItem){var x;
> if(x=document.getElementById(theItem)){
> x.style.display=x.style.display=='none'?'':'none';
> }
> }
>
> onclick="showhideDiv('divImage2')"
>
>
> Mick
>
>
>
>> <img src="/graphics/4arrow4.gif" id="Image2"
>>
onMouseOver="MM_swapImage('Image2','','/graphics/4arrow2.gif',1)"
>> onMouseOut="MM_swapImgRestore()"
onclick="showhideDiv(divImage2)"
>> style="cursor: hand" alt="">
>>
>>
>> to hide and show this div:
>>
>> <div id="divImage2" style="display:
none;"><table width="100%" border="0"
>> cellspacing="0" cellpadding="2"
bgcolor="#DBE2EC"><tr><td
>> width="300"><img
>> src="/img/products/2550C1smC.jpg" vspace=2 hspace=2 border=0
>> alt=""></td><td
>> class="main-small"><A
>>
HREF="zcom.asp?pg=products&specific=jnrqorg4">click here
for
>> details...</a></td></tr></table></div>
>>
>> I'm getting the error, "divImage2 is not defined" for the
onclick.
>>
>> Can any of you js gurus help?
>>
>> Thanks,
>> Mickey
>>
>>
|
| Post Reply
|
| Re: javascript deficient |
 |
Sun, 31 Dec 2006 12:52:07 -050 |
Mickey wrote:
> That's the ticket. THANK YOU MICK!!!!!!!
>
No problem...
Mick
>>function showhideDiv(theItem){var x;
>>if(x=document.getElementById(theItem)){
>>x.style.display=x.style.display=='none'?'':'none';
>>}
>>}
>>
>>onclick="showhideDiv('divImage2')"
>>
>>
|
| Post Reply
|
|
|
|
|
|
|
|
|
|