Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

" iframe" AND contentDocument Property please help

Status
Not open for further replies.

shawkani

IS-IT--Management
Apr 28, 2007
1
SA
Hi everybody, How all of you,

I have a strange problem and I need creative people , so I write my problem here

look I try to get the result from w3c validator and but it in alert function...
so the design of my web page is like following : I hope all try


CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns=" >
<head>
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">


function kkk() {
var x=document.getElementById("frame1").contentDocument;
var y =x.getElementsByTagName("td")[0].childNodes[0].nodeValue;

alert(x.getElementsByTagName("td")[0].childNodes[0].nodeValue);

}

</script>
</head>
<body>
<form id="form1" action=" method="post" target="frame1">
<p>
<label for="fragment" title="Paste a complete (HTML) Document here">
</label>
&nbsp;</p>
<p style="text-align: center">
<label for="fragment" title="Paste a complete (HTML) Document here">
<textarea id="fragment" dir="ltr" name="fragment" onclick="return fragment_onclick()"
rows="12" style="width: 498px">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " />
<label title="Submit markup for validation">
<input type="submit" value=" start " />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
</label>
&nbsp;<input id="Button1" onclick="fragment.value=' ';" style="width: 78px" type="button"
value="clear" />
</p>
</form>
<input id="Button2" type="button" value="result" onclick="kkk()" />
<iframe id="frame1" name="frame1" src=HTMLPage2.htm >
</iframe>

</body>
</html>



Now, the HTMLpage2.htm that you see in iframe is just like the validator page and it is code as the following..

CODE
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"<html xmlns=" xml:lang="en" lang="en">
<head>
<title>Result for upload://Form Submission - W3C Markup Validator</title>
<link rev="made" href="mailto: />
<link rev="start" href="./" title="Home Page" />
<style type="text/css" media="all">@import "./base.css";</style>
<meta name="keywords" content="HTML, HyperText Markup Language, Validation,
W3C Markup Validation Service" />

<meta name="description" content="W3C's easy-to-use
HTML validation service, based on an SGML parser." />
</head>

<body>
<div id="banner">
<h1 id="title">
<a href=" height="48" alt="W3C" id="logo" src=" /></a>
<a href=" src=" alt="QA" /></a>
Markup Validation Service</h1>
<span id="versioninfo"><abbr title="version">v</abbr>0.7.4</span>
</div>
<ul class="navbar" id="menu">
<li><span class="hideme"><a href="#skip" accesskey="2" title="Skip past navigation to main part of page">Skip Navigation</a> |</span>
<a href="./" accesskey="1" title="Go to the Home Page for The W3C Markup Validation Service"><strong>Home</strong></a></li>
<li><a href="./about.html" title="Information About this Service">About...</a></li>
<li><a href="./whatsnew.html" title="The changes made to this service recently">News</a></li>
<li><a href="./docs/" accesskey="3" title="Documentation for this Service">Docs</a></li>
<li><a href="./docs/help.html" title="Help and answers to frequently asked questions">Help&nbsp;&amp;&nbsp;<acronym title="Frequently Asked Questions">FAQ</acronym></a></li>
<li><a href="./feedback.html" accesskey="4" title="How to provide feedback on this service">Feedback</a></li>
</ul>



<div id="main">
<div id="head">
<div id="jumpbar">
Jump To:
<ul>
<li><a title="Result of Validation" href="#result">Results</a></li>





</ul>
</div>


<form id="form" method="get" action="check">
<table class="header">
<tr>
<th>Result:</th>

<td colspan="2" class="invalid">
Failed validation, 1 error

</td>
</tr>
<tr>

<th>File:</th><td colspan="2">upload://Form Submission</td>

</tr>



<tr><th>Encoding:</th><td colspan="2">utf-8</td></tr>
<tr><th>Doctype:</th><td colspan="2">HTML 4.01 Strict</td></tr>



</table>

</form>


</div><!-- end of "head" -->




<a id="skip" name="skip"></a>

<div id="result">
<h3 id="results" class="invalid">This page is <strong>not</strong> Valid HTML 4.01 Strict!</h3>

<p>
Below are the results of attempting to parse this document with
an SGML parser.
</p>


<ol>


<li class="msg_err">
<span class="err_type">Error</span>
<em>Line 1 column 90</em>:
<span class="msg">no document element</span>.<pre><code class="input">...tp:// title="Position where error was detected.">></strong></code></pre> <p class="helpwanted">
<a
href="feedback.html?uri=;errmsg_id=100#errormsg"
title="Suggest improvements on this error message through our feedback channels"
>&#x2709;</a>
</p>
</li>


</ol>
</div>


</div><!-- end of "main" -->

<address>
<a href=" src=" height="31" width="88"
alt="Valid XHTML 1.0!" /></a>
<a title="Send Feedback for the W3C Markup Validation Service"
href="./feedback.html">The W3C Validator Team</a><br />
</address>
</body>
</html>




Why I Put all these .... because I want all of you to try and see and help me

so, try to desing both pages make copy& past. when u view it in browser ( please use Opera or FireFox becuse some of the code not supported by IE)
and u press the result button the alert will apper and show the result from HTMLpage2.htm

but

if u press start the validator will loaded and the result will appear based on the code u write in the textarea.
now if u press result button it will not work !!!!!!!!!!!!!!!!!

I do not why?
both code in HTMLpage2 and validator page is same but since i use target to load the reult in Iframe ... it willl not work

I want to know why and what will be the soultion.. i want to get the result form validator that based in what you write in textarea... Hoplease help me .... pleaaaaaaaaaaaaaaaaaaaaase do not ignore me

with alooot of thanks,
please again ... help me..
 
[tt]function kkk() {
var x=document.getElementById("frame1").contentDocument;
[blue]netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");[/blue] //user has to allow it
var y =x.getElementsByTagName("td")[0].childNodes[0].nodeValue;
alert(y);
}
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top