Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Browsers / Internet Explorer / May 2004



Tip: Looking for answers? Try searching our database.

Get a element in iframe, have strange problem,help!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fred - 12 May 2004 03:21 GMT
A iframe with name "frameAccountInfo",it has a input element which name property and id property are "accountStat"
I write a script to get the value of accountSta
<script
1    var acobj = document.frames.frameAccountInfo.document
2   alert(acobj.all)
3    alert(acobj.body.all.accountStat.value);                                          
</script
It alerts [object] and [useable
but if I comment the line 2, it shows a javascript error “missing object", why ?Thanks a lot

Regard
Fred - 12 May 2004 06:41 GMT
the cod
----------parent.html-----------------------
<HTML></HEAD><BODY><iframe name="frameAccountInfo" src="frame.html" width="706" height="150"></iframe><script>
    var acobj = document.frames.frameAccountInfo.document
    //alert(acobj.all)
    alert(acobj.body.all.accountStat.value);  
</script></BODY></HTML
---------------------frame.html---------------
<HTML></HEAD><body bgcolor="#ffffff"><TABLE class="info" id="Table1" cellSpacing="0" cellPadding="0"><TR><TD class="label" noWrap>帐户状态</TD><TD class="text"><input readOnly type="text"id=accountStat name=accountStat class=noborder-normal style="WIDTH:80px;" value=可用></TD><TD class="label" noWrap>地区码</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:80px;" value=574></TD><TD class="label" style="HEIGHT: 25px">积分值</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:80px;" value=0></TD><TD class="label">可用金额</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:80px;" value=0></TD></TR><TR><TD class="label" style="HEIGHT: 25px">预定金额</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:80px;" value=0></TD><TD class="label" noWrap>赠送金额</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:80px;" value=0></TD><TD class="label" noWrap>可透支金额</TD><TD class="text"><input readOnly type="text"class=noborber-normal style="WIDTH:80px;" value=></TD><TD class="label" noWrap>自动转帐金额</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:80px;" value=0></TD></TR><TR><TD class="label">生效日期</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:80px;" value=></TD><TD class="label">失效日期</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:100px;" value=></TD><TD class="label">修改日期</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:100px;" value=2004-04-05&nbsp;09:38:51></TD><TD class="label">赠送金额<BR>截至日期</TD><TD class="text"><input readOnly type="text"class=noborder-normal style="WIDTH:100px;" value=></TD></TR></TABLE></body></HTML>
Vidar Petursson - 21 May 2004 10:24 GMT
Hi

alert(document.frames["IFRAMENAME"].document.forms[0].ELEMENTNAME.value);
You may want to check the readystate of the frame before accessing it

if(document.frames["IFRAMENAME"].document.readyState == "complete")

More info:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/referen
ce/dhtml_reference_entry.asp


Signature

Best Regards
 Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================

>A iframe with name "frameAccountInfo",it has a input element which name
>property and id property are "accountStat";
[quoted text clipped - 9 lines]
>
> Regard
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.