AllExperts > DHTML 
Search      
DHTML
Volunteer
Answers to thousands of questions
 Home · More DHTML Questions · Answer Library  · Encyclopedia ·
More DHTML Answers
Question Library

Ask a question about DHTML
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Andrew Hoffman
Expertise
I can field just about any question within this topic ranging from JavaScript to CSS, the two ingredients of DHTML. I`m very interested in the W3C and its validation rules for HTML, XHTML, and CSS, and enjoy answering questions of this type as well. I detest sleep and respond at all hours of the day or night.


Experience
Experience in the area
I've been working with DHTML and CSS for 7 years now and build/maintain websites of my own that implement DHTML navigation.

What I'm doing now
My contract with Microsoft has ended and I am working for myself once again. Please contact me for any front-end work at antibland@gmail.com

 
   

You are here:  Experts > Computing/Technology > HTML/XML > DHTML > form javascript and MSIE

DHTML - form javascript and MSIE


Expert: Andrew Hoffman - 6/24/2007

Question
Hi! I have a problem here, than I can't solve. The following code works fine on Mozilla-based browsers, but it shows alerts and does not work on MSIE. What could been happening? Thank you very much

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>The form that does not submit in MSIE</title>
  <script type='text/javascript'><!--
     function darle(idsol,pest){
        document.forms['form1'].action = 'otro.html' ;
        document.forms['form1'].submit();
     }
  //-->
  </script>
</head>
<body>
<form id='form1' name='form1' action='otherpage.php' method='post' enctype='multipart/form-data'>
  <select class='inpt' id='alternativa' name='alternativa'>
     <option value='0' selected='selected'>etapa</option>
     <option value='1' >alternativa</option>
  </select>
</form>
  <table>
     <tr><td style='background-color:#ffffff'>lista de tareas</td>
        <td style='background-color:#9999ff'>
              <a href='javascript:void(0)' onclick='darle(0,1)'>reconocimientos</a>
        </td>
     </tr>
     <tr><td colspan='2'>the content
        </td>
     </tr>
  </table>
</body>
</html>


Answer
Replace the javascript:void(0) with a # symbol, like this:

a href='javascript:void(0)' onclick='darle(0,1)'>reconocimientos</a>

<a href='#' onclick='darle(0,1)'>reconocimientos</a>

I believe IE6 was trying to execute the void(0) instead of the actual function you wanted to call.  Seems to work now, though.

- Andrew

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.