|
Posted by Jonathan N. Little on September 7, 2007, 2:47 pm
Please log in for more thread options
pistacchio wrote:
>> Hello,
>>
>>
>>
>> pistacchio wrote:
>>> the site i'm working on (http://www.gdp-portfolio.net/as/) is html
>>> 4.1 strict valid. needless to say, it has some incompatibility problem
>>> with explorer (testing with IE 6.0).
>>> The menu works great with firefox going from one page to the other.
>>> the code is:
>>> <a href = "#"><button><div id = "Bmenu2" onClick = "document.location
>>> = 'index.php?p=Chi'" onMouseOut = "javascript: menu.nascondi(2);"></
>>> div></button></a>
>>> and it doesn't work in IE. i've altro tried:
>>> - "onClick" in <button>
>>> - setting the href in <a>
>>> but no solution seems to work. any help?
>> Why use ONCLICK to fake a link at all? The only case I could think of, is
>> that the destination absolutely requires for some reason JavaScript and
>> should not be reachable by user-agents without JS. Even in that case HREF
>> should not be empty, but point to a document explaining this restriction.
>> So, if you really need JavaScript triggered by ONCLICK, put this and the
>> other attributes of the DIV into the A start-tag.
>> And what should be the purpose of the BUTTON element? Is the link contained
>> in a FORM? Although it is valid, BUTTONs outside of a FORM do not make
>> sense.
>>
>> Surprisingly the code is actually valid. BUTTON allows (like INS or DEL)
>> to 'smuggle' block elements into places where only inline is allowed. In
>> contrast to INS/DEL I could not find any reference that it is not
>> conforming to use that trick...
>>
>> HTH
>>
>> --
>> Benjamin Niemann
>> Email: pink at odahoda dot de
>> WWW:http://pink.odahoda.de/
>
> it is not in a for and there's actually no need to use a javascript
> code. now, i got rid of the button tag and the javascript and i
> inserted the href in <a>.
> you can check the page here:
> http://www.gdp-portfolio.net/as/
>
> it still doesn't work in IE.
>
> here you check the validator:
>
>
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.gdp-portfolio.net%2Fas%2Findex.php&charset=%28detect+automatically%29&doctype=Inline&group=0
Cannot have a block element 'DIV' within an inline element 'A'. Anyway
why bother? Just put the JavaScript to change document's location (yes
using the 'onclick' attribute is JavaScript) and use the A's href as
links are supposed to work. If you want the hover effect then then style
the A elements as block and swap the background on hovers
A#menu1 { display: block; background-image(url(button1-off.jpg)... }
A#menu1:hover { background-image(url(button1-on.jpg) }
...
of course you need to style your new "blocks" to be the size your want
as if they where DIVs...
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
|