{"id":6799,"date":"2012-08-31T11:46:31","date_gmt":"2012-08-31T06:16:31","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=6799"},"modified":"2016-12-19T14:46:58","modified_gmt":"2016-12-19T09:16:58","slug":"common-jsphml-javascript-problems","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/common-jsphml-javascript-problems\/","title":{"rendered":"Common JSP\/HTML &amp; Javascript Problems"},"content":{"rendered":"<p>Some of the commonly faced problems are:<\/p>\n<p>1) In case we give  different width combinations for cells of different rows, the width  combination of first row is accepted and subsequent combinations are  neglected.<\/p>\n<p>[html]<\/p>\n<p>&amp;amp;lt;tr&amp;amp;gt;<br \/>\n&amp;amp;lt;td width=&amp;amp;quot;30%&amp;amp;quot;&amp;amp;gt;1.1&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;td width=&amp;amp;quot;50%&amp;amp;quot;&amp;amp;gt;1.2&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;td width=&amp;amp;quot;20%&amp;amp;quot;&amp;amp;gt;1.3&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;\/tr&amp;amp;gt;<\/p>\n<p>&amp;amp;lt;tr&amp;amp;gt;&amp;amp;lt;td width=&amp;amp;quot;50%&amp;amp;quot;&amp;amp;gt;2.1&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;td width=&amp;amp;quot;40%&amp;amp;quot;&amp;amp;gt;2.2&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;td width=&amp;amp;quot;10%&amp;amp;quot;&amp;amp;gt;2.3&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;\/tr&amp;amp;gt;<\/p>\n<p>[\/html]<\/p>\n<p>In this case width of first, second and third cell would be 30%, 50% and 20% for both the rows.<\/p>\n<p>2) If we have defined width combinations for first row cells and we  use  both colspan and width attribute for cell of other row, then width   attribute becomes ineffective.<\/p>\n<p>If we want to have table as shown above, we can have each row with   one cell and each of the cells would have a table with single row. That   ways, the cells of the row can be arranged as per our specifications  and  requirements.<\/p>\n<p>[html]<\/p>\n<p>&amp;amp;lt;tr&amp;amp;gt;<br \/>\n&amp;amp;lt;td&amp;amp;gt;<br \/>\n&amp;amp;lt;table border=&amp;amp;quot;2px&amp;amp;quot; width=&amp;amp;quot;100%&amp;amp;quot;&amp;amp;gt;<br \/>\n&amp;amp;lt;tr&amp;amp;gt;<br \/>\n&amp;amp;lt;td width=&amp;amp;quot;80%&amp;amp;quot;&amp;amp;gt;New&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;td width=&amp;amp;quot;20%&amp;amp;quot;&amp;amp;gt;Few&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;\/tr&amp;amp;gt;<br \/>\n&amp;amp;lt;\/table&amp;amp;gt;<br \/>\n&amp;amp;lt;\/tr&amp;amp;gt;<\/p>\n<p>&amp;amp;lt;tr&amp;amp;gt;<br \/>\n&amp;amp;lt;td&amp;amp;gt;<br \/>\n&amp;amp;lt;table border=&amp;amp;quot;2px&amp;amp;quot; width=&amp;amp;quot;100%&amp;amp;quot;&amp;amp;gt;<br \/>\n&amp;amp;lt;tr&amp;amp;gt;<br \/>\n&amp;amp;lt;td width=&amp;amp;quot;40%&amp;amp;quot;&amp;amp;gt;New&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;td width=&amp;amp;quot;60%&amp;amp;quot;&amp;amp;gt;Few&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;\/tr&amp;amp;gt;<br \/>\n&amp;amp;lt;\/table&amp;amp;gt;<br \/>\n&amp;amp;lt;\/td&amp;amp;gt;<br \/>\n&amp;amp;lt;\/tr&amp;amp;gt;<\/p>\n<p>[\/html]<\/p>\n<p>3) One of very common problems that we face in when working with   javascript is that we do not get to know what error exactly occurred if   the script is not working as expected. We can use try-catch blocks,  just  as we do in java.<\/p>\n<p>A very basic example:<\/p>\n<p>[js]<\/p>\n<p>function division(){<br \/>\ntry{<br \/>\nvar c = 1\/x;<br \/>\nalert(c);<br \/>\n}<\/p>\n<p>catch(e){<br \/>\nalert(&amp;amp;lt;a href=&amp;amp;quot;http:\/\/e.name&amp;amp;quot; target=&amp;amp;quot;_blank&amp;amp;quot;&amp;amp;gt;e.name&amp;amp;lt;\/a&amp;amp;gt; + &amp;amp;quot; &amp;amp;quot; + e.message)<br \/>\n}<br \/>\n}<\/p>\n<p>[\/js]<\/p>\n<p>Some javascript errors and their description:<\/p>\n<p>Hope it helps. \ud83d\ude42<\/p>\n<p>Regards.<\/p>\n<p>Vivek Sachdeva<\/p>\n<p>vivek.sachdeva@intelligrape.com<\/p>\n<p>@vivek_sach<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some of the commonly faced problems are: 1) In case we give different width combinations for cells of different rows, the width combination of first row is accepted and subsequent combinations are neglected. [html] &amp;amp;lt;tr&amp;amp;gt; &amp;amp;lt;td width=&amp;amp;quot;30%&amp;amp;quot;&amp;amp;gt;1.1&amp;amp;lt;\/td&amp;amp;gt; &amp;amp;lt;td width=&amp;amp;quot;50%&amp;amp;quot;&amp;amp;gt;1.2&amp;amp;lt;\/td&amp;amp;gt; &amp;amp;lt;td width=&amp;amp;quot;20%&amp;amp;quot;&amp;amp;gt;1.3&amp;amp;lt;\/td&amp;amp;gt; &amp;amp;lt;\/tr&amp;amp;gt; &amp;amp;lt;tr&amp;amp;gt;&amp;amp;lt;td width=&amp;amp;quot;50%&amp;amp;quot;&amp;amp;gt;2.1&amp;amp;lt;\/td&amp;amp;gt; &amp;amp;lt;td width=&amp;amp;quot;40%&amp;amp;quot;&amp;amp;gt;2.2&amp;amp;lt;\/td&amp;amp;gt; &amp;amp;lt;td width=&amp;amp;quot;10%&amp;amp;quot;&amp;amp;gt;2.3&amp;amp;lt;\/td&amp;amp;gt; &amp;amp;lt;\/tr&amp;amp;gt; [\/html] In this case width of [&hellip;]<\/p>\n","protected":false},"author":48,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0},"categories":[1],"tags":[4842,55,905,906,887],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/6799"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/48"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=6799"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/6799\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=6799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=6799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=6799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}