IFRAME Problem
Hallo,
I have already desaigned a javascript to manipulate a page but I have to show it in a new page with an invisible IFRAME. The code is
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript" language="javascript">
function start() {
var objIFrame = document.getElementById("IFrame1") ;
var srcHTML = objIFrame.contentWindow.document.documentElement;
window.alert(srcHTML);
var mybody = srcHTML.getElementsByTagName("body")[0];
window.alert(mybody);
var myDiv = mybody.getElementsByTagName("div")[2];
mytable = document.createElement("table");
mytablebody = document.createElement("tbody");
// creating all cells
// creates a <tr> element
mycurrent_row = document.createElement("tr");
// creates a <td> element
mycurrent_cell = document.createElement("td");
// creates a Text Node
currenttext = document.createTextNode("Link" );
// appends the Text Node we created into the cell <td>
mycurrent_cell.appendChild(currenttext);
// appends the cell <td> into the row <tr>
mycurrent_row.appendChild(mycurrent_cell);
// appends the row <tr> into <tbody>
mytablebody.appendChild(mycurrent_row);
// creates a <td> element
mycurrent_cell2 = document.createElement("td");
// creates a Text Node
currenttext2 = document.createTextNode("Source" );
// appends the Text Node we created into the cell <td>
mycurrent_cell2.appendChild(currenttext2);
// appends the cell <td> into the row <tr>
mycurrent_row.appendChild(mycurrent_cell2);
// appends the row <tr> into <tbody>
mytablebody.appendChild(mycurrent_row);
// creates a <td> element
mycurrent_cell3 = document.createElement("td");
// creates a Text Node
currenttext3 = document.createTextNode("Date" );
// appends the Text Node we created into the cell <td>
mycurrent_cell3.appendChild(currenttext3);
// appends the cell <td> into the row <tr>
mycurrent_row.appendChild(mycurrent_cell3);
// appends the row <tr> into <tbody>
mytablebody.appendChild(mycurrent_row);
// creates a <td> element
mycurrent_cell4 = document.createElement("td");
// creates a Text Node
currenttext4 = document.createTextNode("Words" );
// appends the Text Node we created into the cell <td>
mycurrent_cell4.appendChild(currenttext4);
// appends the cell <td> into the row <tr>
mycurrent_row.appendChild(mycurrent_cell4);
// appends the row <tr> into <tbody>
mytablebody.appendChild(mycurrent_row);
// creates a <td> element
mycurrent_cell5 = document.createElement("td");
// creates a Text Node
currenttext5 = document.createTextNode("Language" );
// appends the Text Node we created into the cell <td>
mycurrent_cell5.appendChild(currenttext5);
// appends the cell <td> into the row <tr>
mycurrent_row.appendChild(mycurrent_cell5);
// appends the row <tr> into <tbody>
mytablebody.appendChild(mycurrent_row);
var i = 2;
do {
table = myDiv.getElementsByTagName("table")[i];
row = table.getElementsByTagName("tr")[0];
col = row.getElementsByTagName("td")[0];
span = col.getElementsByTagName("span")[0];
spanT = span.firstChild.nodeValue;
col2 = row.getElementsByTagName("td")[1];
anch = col2.getElementsByTagName("A")[0];
childAnch = anch.firstChild.nodeValue;
lSpan = col2.getElementsByTagName("span")[0];
lSpan1 = lSpan.firstChild.nodeValue;
myArray = lSpan1.split(/,/);
var j = 0;
/*do{
window.alert(myArray[j]);
j++;
}
while(j<myArray.length) */
text= spanT+" "+childAnch+" "+lSpan1;
//window.alert(text);
myRow = document.createElement("tr");
myTd1 = document.createElement("td");
myText1 = document.createTextNode(spanT+" "+childAnch+" ");
myTd1.appendChild(myText1);
myRow.appendChild(myTd1);
mytablebody.appendChild(myRow);
myTd2 = document.createElement("td");
myText2 = document.createTextNode (myArray[0]);
myTd2.appendChild(myText2);
myRow.appendChild(myTd2);
mytablebody.appendChild(myRow);
myTd3 = document.createElement("td");
myText3 = document.createTextNode (myArray[1]);
myTd3.appendChild(myText3);
myRow.appendChild(myTd3);
mytablebody.appendChild(myRow);
myTd4 = document.createElement("td");
myText4 = document.createTextNode (myArray[2]);
myTd4.appendChild(myText4);
myRow.appendChild(myTd4);
mytablebody.appendChild(myRow);
myTd5 = document.createElement("td");
myText5 = document.createTextNode (myArray[3]);
myTd5.appendChild(myText5);
myRow.appendChild(myTd5);
mytablebody.appendChild(myRow);
mytable.appendChild(mytablebody);
if(mybody!=null)
mybody.appendChild(mytable);
//p = document.createElement("p");
//currentText= document.createTextNode(spanT+" "+childAnch+" "+lSpan1);
//p.appendChild(currentText);
//mybody.appendChild(p);
i++;
} while (myDiv.getElementsByTagName("table")[i] != null)
mytable.setAttribute("border","2");
}
</script>
</head>
<body onLoad="start()">
<IFRAME ID="IFrame1" FRAMEBORDER=0 SCROLLING=NO style="width:0px; height:0px; border: 0px"
src="file:///X|/Private/Factiva/Factiva1.htm"></IFRAME>
</body>
</html>
This code gives here the invalid argument error here
mybody.appendChild(mytable);
But this code works completely without any errors (except the first two lines of the javascrupt which I didn't use in that way) in the source of IFRAME link. How can I solve this problem?
Your attitude determines your altitude
__________________
Your attitude determines your altitude
|