Jump to content

Why is my italian button so small? Solved with thanks in final post.


niche

Recommended Posts

This is my first completely original JS. Why is my italian button so small?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="description" content="Save money" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>subcat</title><script type="text/javascript">function subcat() {   var div = document.getElementById('subcat'); //get the container on the page   div.innerHTML = ''; //clear out the subcat   var new_subcat = document.createElement('form'); //create form   new_subcat.action = "italian.php";   new_subcat.id = "italian";     var new_subcatB = document.createElement('button'); //create button   new_subcatB.class = "button";   new_subcatB.type = "input";   div.appendChild(new_subcat);   //div.appendChild(new_subcatB);   //document.getElementById('italian').innerHTML=new_subcatB;   document.getElementById('italian').appendChild(new_subcatB);}</script><style type="text/css">.button {padding:0px;width:82px;height:40px;vertical-align:top;}</style></head><body><?phpecho '<div style="float:left;height:100px;width:350px;background:yellow;">';   echo '<div style="float:left;height:40px;width:350px;background:pink;">';	  echo '<button class="button" onclick="subcat()" >restaurants';	  echo '</button>';   echo '</div>';     echo '<div id="subcat" style="float:left;height:40px;width:350px;background:Aqua;">';   echo '</div>';echo '</div>';?> </body></html>

Edited by niche
  • Like 1
Link to comment
Share on other sites

Oops. Thanks for your help Ingolme and eTianbun.

Link to comment
Share on other sites

new_subcatB.type='input'

Does the <button> attr (type) have the property 'input'? I have'nt seen that before:

How would you do it? This works in FF not in IE. Edited by niche
Link to comment
Share on other sites

You could probably remove that line and it will behave the same. input is not a valid value for the type attribute on the button, so the browser will treat it as though the type were set to button. Same as if the type attribute were omitted altogether.

  • Like 1
Link to comment
Share on other sites

Simple enough. Thanks ShadowMage and thanks again Ingolme and eTianbun for your help with a very satisfying topic.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...