[blind-programming] Re: HTML Dom Tree

  • From: Jacques Bosch <jfbosch@xxxxxxxxx>
  • To: blind-programming@xxxxxxxxxxxxx
  • Date: Wed, 20 Apr 2011 11:40:56 +0200

Hi Paniz.

I took your file and demonstrated some jQuery routines on it.
I also added another paragraph tag and 2 more text inputs.
Hope it helps.
It is also possible to respond to events such as clicks and keypresses.


*start of html*

<html>
<head>
    <title>Untitled Page</title>
    <!-- Include jQuery off the google CDN -->

    <script src="
//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js";></script>

    <script type="text/javascript">
        // Hook into the jQuery ready event (when page has done loading)
        $(document).ready(function() {

            // Here follow examples of accessing elements via selectors, and
manipulating them.

            // Using jQuery, find the element with the id of 'Text1' and
assign a value to it.
            $("#Text1").val("sample value");

            // Using jQuery, find all paragraphs on the page by their tag
name, and change their 'dir' attribute to left-to-right.
            $("P").attr("dir", "ltr");

            // Using jQuery, find the body element by tag name, and change
its background color to yellow.
            $("BODY").css("background-color", "yellow");

            // Using jQuery, find all input elements of type 'text' that are
inside of paragraph elements that have a class value of 'testCssClass', and
set their value to 'sample value 2'.
            $("P.testCssClass input[type='text']").val("sample value 2");

        });
    </script>

</head>
<body>
    <p align="left" dir="rtl">
        <input id="Text1" type="text" />
        name&nbsp;
    </p>
    <p align="left" class="testCssClass">
        name 2&nbsp;
        <input id="Text2" type="text" />
        <br />
        name 3&nbsp;
        <input id="Text3" type="text" />
    </p>
</body>
</html>

*end of html*














On Wed, Apr 20, 2011 at 9:40 AM, paniz alipour <alipourpaniz@xxxxxxxxx>wrote:

> Hi,
>
> <head>
>     <title>Untitled Page</title>
> -- forxample I have a function of javascript here
> </head>
> <body>
>
>     <p align="left" dir="rtl">
>         <input id="Text1" type="text" /> name&nbsp;
>     </p>
>
> </body>
> </html>
>  for example consider this part of code,OK.I want to access this part of
> code and nodes like body ,p ,.... and javascripts code that exist in
>
> webpage.and then do some thing on it,
>
> I want to do this via javascript code in extension of for example
> firefox.so by this explanation how should I do this?
>
>
> Thanks
>
> On Wed, Apr 20, 2011 at 11:25 AM, Jacques Bosch <jfbosch@xxxxxxxxx> wrote:
>
>> You'd have to give more information than that. What node / kind of node do
>> you want to access. And what extension do you mean?
>> Generally though, you would use what is known as a selector to get hold of
>> the HTML element you want. A selector is basically just some criteria to
>> identify a specific element, almost like a *WHERE* clause in SQL. Selectors
>> come from CSS, and using them would require that you have some knowledge of
>> HTML.
>>
>> Before you can use jQuery, you have to include it in a <script> tag in the
>> <head> section of your HTML page.
>>
>> If you send me a small sample HTML file, and explain exactly what it is
>> you want to access, then I, or others, could assist in getting you started.
>>
>> Jacques
>>
>>
>> On Wed, Apr 20, 2011 at 8:35 AM, paniz alipour <alipourpaniz@xxxxxxxxx>wrote:
>>
>>> I need to access rendered Dom,for accessing node via extension.how can I
>>> do it?
>>>
>>>
>>> On Tue, Apr 19, 2011 at 1:48 PM, Jacques Bosch <jfbosch@xxxxxxxxx>wrote:
>>>
>>>> If you want to work with the DOM in code, it is hard to get something
>>>> better and more powerful than jQuery.
>>>> www.jquery.com
>>>> Some learning curve, but hundreds of times easier and more robust than
>>>> working with the DOM directly!
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Apr 19, 2011 at 8:18 AM, paniz alipour 
>>>> <alipourpaniz@xxxxxxxxx>wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> The work I want to do is reading and access DOM and then do other works
>>>>> ,i want to make it i my self not via firebug.But you mention an important
>>>>> point,firebug!
>>>>>
>>>>> how does it render DOM Tree and javascript codes?
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>> On Tue, Apr 19, 2011 at 10:30 AM, E.J. Zufelt <lists@xxxxxxxxx> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> It is possible to access the DOM using the Firebug plugin for Firefox.
>>>>>>  Firebug can be used with JAWS, but I have found that it works best with
>>>>>> NVDA.
>>>>>>
>>>>>> I hope this answers your question.  Please let us know more details of
>>>>>> what you are trying to accomplish if it does not.
>>>>>>
>>>>>> Thanks,
>>>>>>  Everett Zufelt
>>>>>> http://zufelt.ca
>>>>>>
>>>>>> Follow me on Twitter
>>>>>> http://twitter.com/ezufelt
>>>>>>
>>>>>> View my LinkedIn Profile
>>>>>> http://www.linkedin.com/in/ezufelt
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 2011-04-19, at 1:44 AM, paniz alipour wrote:
>>>>>>
>>>>>> Hello All,
>>>>>>
>>>>>> I have a problem,I don't know how can I access the rendered HTML I
>>>>>> mean(DOM Tree),and reading the part of pages in Dom (specially 
>>>>>> javascripts
>>>>>> code).
>>>>>>
>>>>>> please guide me
>>>>>>
>>>>>> --
>>>>>> Paniz Alipour
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Paniz Alipour
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Jacques Bosch
>>>>
>>>> Software Architecture and Development
>>>> Independent Contractor
>>>> Cell: +27 824711807 Fax: +27 86 504 4726
>>>> E-Mail: jfbosch@xxxxxxxxx
>>>>
>>>>
>>>
>>>
>>> --
>>> Paniz Alipour
>>>
>>
>>
>>
>> --
>>
>> Jacques Bosch
>>
>> Software Architecture and Development
>> Independent Contractor
>> Cell: +27 824711807 Fax: +27 86 504 4726
>> E-Mail: jfbosch@xxxxxxxxx
>>
>>
>
>
> --
> Paniz Alipour
>



-- 

Jacques Bosch

Software Architecture and Development
Independent Contractor
Cell: +27 824711807 Fax: +27 86 504 4726
E-Mail: jfbosch@xxxxxxxxx

Other related posts: