Jump to content

Iframe.conntentDocument ... Please.. see and try!


Recommended Posts

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><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="http://Validator.w3.org/check" 		method="post" target="frame1">		<p>			<label for="fragment" title="Paste a complete (HTML) Document here">			</label>			 </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"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"></textarea></label><br />			<label title="Submit markup for validation">				<input type="submit" value="  start " />				              			</label>			 <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..

<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  <head>	<title>Result for upload://Form Submission - W3C Markup Validator</title>	<link rev="made" href="mailto:www-validator@w3.org" />	<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="http://www.w3.org/"><img height="48" alt="W3C" id="logo" src="http://www.w3.org/Icons/WWW/w3c_home_nb" /></a>		<a href="http://www.w3.org/QA/"><img src="http://www.w3.org/QA/2002/12/qa-small.png" 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 & <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://www.w3.org/TR/html4/strict.dtd"<strong 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" 	  >✉</a>	</p>	  </li>  	</ol>  </div>	  	</div><!-- end of "main" -->	<address>	  <a href="http://validator.w3.org/check?uri=referer"><img		src="http://www.w3.org/Icons/valid-xhtml10" 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 meso, 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.htmbut 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 :blink: 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... Howwww???please help me .... pleaaaaaaaaaaaaaaaaaaaaase do not ignore me :blink: with alooot of thanks, please again ... help me..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...