[Dojo-interest] IE and javascript

Praveen Alvandi praveen.alvandi at gmail.com
Fri Aug 1 16:59:48 UTC 2008


Thanks alot Gaurav for the interest and response.




My code is as follows:

The page is basically a JSP.

0.  <HTML>

1.    <BODY>

2.      <DIV>

 3.        <TABLE>

4.          <TBODY id='x'>

5.               <TR>         // ROW that has the column heading

6.                 <TD>       // Each TD has a column heading

7.                 </TD>

8.                 <TD>

9.                 </TD>

10.                <TD>

11.                </TD>

 12.              <TR>

13.       </TABLE>

14.     </DIV>

15.   </BODY>

16.  </HTML>




JS Code:

17. var a = docRoot.getElementByID('x');

18. var trElement = document.createElement('tr');

19. trElement.setAttribyte('id',tr1);

20. trElement.setAttribyte('type', 'checkBox');

21. trElement.setAttribyte('onclick', 'alert('hi')');

//add a few TDs

22. var tdElement = document.createElement('td')

 23. tdElement.setAttribyte('id',td1);

24. tdElement.setAttribyte('value','td');




I need to display the data as a set of rows, with each having a checkbox (to
be click-selected for row deletion).

Now, the onclick tht I hav in line 21 doesnt work in IE if I add it
dynamically through JS (user input) after the page is rendered.

The explaination is contained in the MSDN link.

Now, to make the events to work in IE I changed the <table> to <div> and
instead of adding  <tr>s i plan to add <div>s with a check box and data.

However, I am finding it difficult when it comes to alignment. I tried a lot
of things, however the alignment is completely screwed up.

The thing is the data in the dynamically added <div>s doesnt match with the
<div> that has the column headings (replaced in Line 5)

Please help me.


Regards
Praveen










On 8/1/08, Gaurav Vaish <gvaish.java at gmail.com> wrote:
>
>  Hi Praveen,
>
> Since I do not have any idea of the code that you've written, here's my
> suggestion...
>
>
>
> Table, in IE, will now show any rows unless <tbody> is supplied.
>
> Use the following:
>
> 0. tbodyElement = document.createElement('tbody')
> 1. tableElement.appendChild(tbodyElement
>
> 2. trElement.appendChild(tdElement)
> 3. tdElement.appendChild(cbElement)
>     where
>         tdElement = document.createElement('td')
>     and
>         cbElement = document.createElement('input')
>         cbElement.type = 'checkbox'
>         cbElement.name = 'cbName'
>     etc
>
>
> HTH
>
>
> Happy Hacking,
> Gaurav Vaish | http://dwt.sourceforge.net
> http://blogs.mastergaurav.com | http://eduzine.edujini-labs.com
> --------------------------------
>
>
>
>
>
>
>
>  ----- Original Message -----
> *From:* Praveen Alvandi <praveen.alvandi at gmail.com>
> *To:* dojo-interest at dojotoolkit.org
> *Sent:* Friday, August 01, 2008 14:40
> *Subject:* Re: [Dojo-interest] IE and javascript
>
>
> This is in continuation to the Problem i have listed below in Bold.
> Now, that i have removed the table tag, what other element can i use to get
> the allignment and formatting that i would get if i used the table tag.
>
> I tried using div however the allignment seems to be completely screwed up.
>
> Please help.
>
> Praveen
>
> On Thu, Jul 31, 2008 at 8:18 PM, Praveen Alvandi <
> praveen.alvandi at gmail.com> wrote:
>
>> Hey i found the solution for this one. The reason this happened is that
>> once the page is displayed in IE its is readonly.(
>> http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx<http://msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx>
>> )
>>
>> Now, the checkbox i mentioned here got added dynamically(ie i used to add
>> the CB in the JS). I  tried to change the \<table>\ tag to \<div>\. It
>> worked.
>>
>>
>> Regards
>> Praveen
>>
>>
>>
>>
>>
>> On Thu, Jul 31, 2008 at 3:40 PM, Praveen Alvandi <
>> praveen.alvandi at gmail.com> wrote:
>>
>>>  *Hello,*
>>>
>>> *I have just started using Dojo. Its really awesome. Thanks alot for the
>>> effort of putting it togather guys.*
>>>
>>> *I have a 4th level nested table in a div as follows.*
>>> *div1 * *div2 * *div3 *
>>>
>>> *I have a checkbox in the table as tr.*
>>>
>>> *I have a set of information as a group that i display as td*
>>>
>>> *Now when anybody has to delete a set of data he clicks on the checkbox
>>> and in the background i populate a var with some delimeter to store the rows
>>> clicked.*
>>>
>>> *This works fine on FF3 However, when i try to run the same code piece
>>> in IE7, nothing happens.*
>>>
>>> *I tried to alert when the checkboxes are clicked however, there is no
>>> alert pop-up in IE7 but, they appear in FF3.*
>>>
>>> *Please help me.*
>>>
>> *
>> *
>>
>
>
>
> ------------------------------
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://turtle.dojotoolkit.org/pipermail/dojo-interest/attachments/20080801/f74801f1/attachment.html 


More information about the Dojo-interest mailing list