Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-16-2003, 08:14 PM   PM User | #1
ScottInTexas
Regular Coder

 
Join Date: Nov 2002
Posts: 567
Thanks: 2
Thanked 4 Times in 4 Posts
ScottInTexas is on a distinguished road
Traversing this tree

My biggest problem with DOM is getting to the elemnts on my page. Consider this structure;

Code:
<body>
    <table id="header"><tr><th></th></tr></table><br>
    <div id="btnBar">
        <table id="btntbl">
        	<tr><form id="tblTree" >
        		<th align="left" width="30%"></th>
    		<th align="left" width="30%"></th>
        		<th width="40%></th>
        	</tr></form>
        </table>
    </div>
    <Div id="DBStruct" >
    	<table id="tblList">
		<form id="tblColForm" >
			<input type=>
			<input type=>
			<input type=>
			<input type=>
		</form>
    	</table>
    </div>
    <iframe id="displayframe" name="displayframe">
         getIt.asp gets loaded here via javascript and contains this form
         <form name="dataEdit" id="dataEdit"  >
         <table id=""displayTable"" >
          <input id="thisOne" type="text" Value="" />
          </table>
          </form>
    </iframe>
</body>
I am trying to get to the fields on the form inside the iframe. I have tried this code but it wont execute the second alert.

Code:
function DoButton(which){
	alert("Doing button");
	alert(document.getElementById("dataEdit").name); 
}
I have cut all the garbbage out so you can see thiis clearly. So how would you get the value or place the value of the field "thisOne"?

Thanks, I hope someone sees this in this forum. I just thought it was more appropriate to the DOM forum.
__________________
Scott Stewart
Always happy to learn from pros.
ScottInTexas is offline   Reply With Quote
Old 10-16-2003, 11:12 PM   PM User | #2
COBOLdinosaur
Regular Coder

 
COBOLdinosaur's Avatar
 
Join Date: Jul 2002
Location: Canada
Posts: 293
Thanks: 0
Thanked 18 Times in 18 Posts
COBOLdinosaur is an unknown quantity at this point
document.frames[0].document.getElementById('dataEdit')

Is what you are looking for I think.
__________________
100% standards compliant code is 100% correct 100% of the time.
one of my toys from my repository and perhaps some help getting help

Cd&
COBOLdinosaur is offline   Reply With Quote
Old 10-16-2003, 11:15 PM   PM User | #3
COBOLdinosaur
Regular Coder

 
COBOLdinosaur's Avatar
 
Join Date: Jul 2002
Location: Canada
Posts: 293
Thanks: 0
Thanked 18 Times in 18 Posts
COBOLdinosaur is an unknown quantity at this point
or more correctly:

top.frames['displayframe'].document.getElementById('dataEdit')

Thought my preference would be:

top.frames['displayframe'].document.forms['dataEdit']

For better cross-browser support
__________________
100% standards compliant code is 100% correct 100% of the time.
one of my toys from my repository and perhaps some help getting help

Cd&
COBOLdinosaur is offline   Reply With Quote
Old 10-17-2003, 01:15 PM   PM User | #4
ScottInTexas
Regular Coder

 
Join Date: Nov 2002
Posts: 567
Thanks: 2
Thanked 4 Times in 4 Posts
ScottInTexas is on a distinguished road
Thanks for your reply.

I hope I get a grip on the Parent/child node business here soon. Then maybe I wont have to ask bonehead questions. I keep looking at MS DOM documentation and after a couple of minutes I have to avert my eyes before they start bleeding.

I did find a nice tutorial that is a little more friendly on another web site (brainjar) so after reading that I may be able to work a little cleaner.

Thanks again.
__________________
Scott Stewart
Always happy to learn from pros.
ScottInTexas is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:05 AM.


Advertisement
Log in to turn off these ads.