Mini
Mini

Reputation: 13

Browser compatibility while using anchor tag

I am using anchor tag for linking my welcome page to my main page. It is working on chrome but not in mozilla.

Code:

 <div id="wel1"><h1>WELCOME TO ASSESMENT ENGINE</h1></div>
 <div id="wel2">
     <div id="wel3"><p id="wel4">Instruction:</p><br>
        <p id="lang">Total number of questions : 5.<br><br>
            Time alloted : 3 minutes.<br><br>
            Each question carry 10 mark, no negative marks.</p> 
     </div>
     <div id="wel5">
        <p id="wel4">
           Note:</p><br>
        <p >
          <ul>
            <li><p>Click the 'Submit Test' button given in the bottom of this page to Submit your answers.</p></li>
            <li><p>Test will be submitted automatically if the time expired.</p></li>
            <li><p>Don't refresh the page.</p></li>
          </ul>
        </p>
     </div>
     <a href="as.html"><button id="bu">START THE TEST</buttton></a>  
 </div>

In this image START THE TEST button working on chrome perfectly but not on mozilla.

Upvotes: 1

Views: 666

Answers (3)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201588

Although the code works if the end tag spelling error is corrected, it is illogical and forbidden in HTML5 to nest interactive elements: the a element must not have interactive content like a button element. A click on such an element could activate the outer element, or the inner element, or both. Although this might not matter in this specific case, it’s still not recommended.

Instead, you can use an image of a button an make it a link:

<a href="as.html"><img src="start.png" alt="START THE TEST" border="0"></a>

or use a minimal form (submitting a form is different from following a link, but the differences often don’t matter, or could be an improvement):

<form action="as.html"><button type="submit">START THE TEST</button></form>  

Upvotes: 1

Jaison James
Jaison James

Reputation: 4552

Spell mistake in the Closing button tag, Use </button> instead </buttton>

Upvotes: -2

Umesh Sehta
Umesh Sehta

Reputation: 10683

You have invalid close tag </buttton> Try:-

<a href="as.html"><button id="bu">START THE TEST</button></a> 

Demo

Upvotes: 2

Related Questions