How do I get hold of this element in my web page

A

Angus

Hello

I have this section in my web page:

<div style="top:0;left:0;width:735;height:348">&nbsp;</div>
<div ARID="640000009" ARType="Char" ARDBN="Call ID" class="df dfro
arfid640000009 ardbnCallID" style="z-index:1032;top:53; left:430;
width:248; height:21;">
<label class="label f9" for="arid640000009" style="top:4; left:0;
width:88; height:17;">Call ID</label><textarea class="text sr "
wrap="off" id="arid640000009" cols="" style="top:0; left:89; width:
159; height:21;" readonly rows=1></textarea>
</div>

And I want to get access to the textarea field to insert the data.
Using the document object model how do I get access using eg
GetElementById to the textarea field? What is the syntax and what ID
am I trying to attach to?
 
S

shimmyshack

Hello

I have this section in my web page:

<div style="top:0;left:0;width:735;height:348">&nbsp;</div>
<div ARID="640000009" ARType="Char" ARDBN="Call ID" class="df dfro
arfid640000009 ardbnCallID" style="z-index:1032;top:53; left:430;
width:248; height:21;">
<label class="label f9" for="arid640000009" style="top:4; left:0;
width:88; height:17;">Call ID</label><textarea class="text sr "
wrap="off" id="arid640000009" cols="" style="top:0; left:89; width:
159; height:21;" readonly rows=1></textarea>
</div>

And I want to get access to the textarea field to insert the data.
Using the document object model how do I get access using eg
GetElementById to the textarea field? What is the syntax and what ID
am I trying to attach to?

<textarea id="t"></textarea>
<script type="text/javascript>
document.getElementById('t').value = 'dynamically entered text';
</script>
you need to know what attributes a tag can have, and sometimes what
the javascript equivalent id. For that hit google, w3schools or the
w3c's site and check out the doctype for html, where you will find the
succint (designed to be consumed by a computer) definition of html.
 
T

Tom Cole

Hello

I have this section in my web page:

<div style="top:0;left:0;width:735;height:348">&nbsp;</div>
<div ARID="640000009" ARType="Char" ARDBN="Call ID" class="df dfro
arfid640000009 ardbnCallID" style="z-index:1032;top:53; left:430;
width:248; height:21;">
<label class="label f9" for="arid640000009" style="top:4; left:0;
width:88; height:17;">Call ID</label><textarea class="text sr "
wrap="off" id="arid640000009" cols="" style="top:0; left:89; width:
159; height:21;" readonly rows=1></textarea>
</div>

And I want to get access to the textarea field to insert the data.
Using the document object model how do I get access using eg
GetElementById to the textarea field? What is the syntax and what ID
am I trying to attach to?

The best way (IMHO) would be to assign an id to the textarea
(id='someID') and then use the document.getElementById('someID')
method. However, it appears that this may be some auto-generated html
(am I right?) in which case you may not have much control over that.

If that's the case, you can use
document.getElementsByTagName('textarea') which should return an array
for you of all textareas on your page. The trick is if you have more
than one, you'll need to be sure you've got the right one. IF there is
only one textarea, then use something like:

var myText = document.getElementsByTagName('textarea')[0];

HTH.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top