Hi lil_puffball,
The html file which i need to show on the bottom frame is on the server. So i can very well access the file. If modifying the file is the only way out, is there any way that we can modify the file just before showing it in the bottom frame and not save the actual file?.
Here is the sample code.
Code for frameset.html
<HTML>
<frameset rows="20%,80%" frameborder="1" id="frameMain">
<frame id="frameTop" src="Buttons.html" width="600">
<frame id="frameBottom" src="Testing.htm" width="600">
</frameset>
</HTML>
Code for top frame:(i'm pasting the entire solution which you gave before - i've replaced the document. with parent.frameBottom.documen
<html>
<style>button{width:200px;
<script>
var clr='yellow';
var offset=2,lineHgt;
var hiliText=new Array();
var hiliLoc=new Array();
var hiliDiv=new Array();
var bkmkText=new Array();
var bkmkLoc=new Array();
var bkmkDiv=new Array();
var x,y,cursorX=null,cursorY=n
function initHiliBkmk(){
var sel=parent.frameBottom.doc
clearHili(false);
sel.moveToElementText(pare
var curSel;
for(i=0;i<hiliLoc.length;i
loc=hiliLoc[i].split("-");
curSel=sel.duplicate();
curSel.moveEnd("character"
if(curSel.text!=""){hili(c
}
for(i=0;i<bkmkLoc.length;i
curSel=sel.duplicate();
curSel.move("character",
bkmkLoc[i]);
if(arguments.length>0){
var img=parent.frameBottom.doc
img.id="bookmark"+i;
img.style.position="absolu
img.style.top=cursorY;img.
img.innerHTML="<img src='bookmark.gif' title='"+bkmkText[i]+"' height=15 unselectable=on>";
img.unselectable="on";
img.onmousedown=function()
parent.frameBottom.documen
}
bkmkDiv[i].style.left=curS
bkmkDiv[i].style.top=curSe
}
}
function hili(sel){
if(sel.text==""){alert("Pl
if(sel.boundingHeight>line
createHili(sel.boundingTop
for(i=1;i<parseInt(sel.bou
createHili(sel.boundingTop
}
var newsel=sel.duplicate();
while(sel.inRange(newsel))
newsel.moveStart("characte
}newsel.moveStart("charact
createHili(newsel.bounding
}else{
createHili(sel.boundingTop
}
if(arguments.length==1){st
}
function storeHili(sel){
hiliText[hiliText.length]=
var tempSel=sel.duplicate(),te
tempSel.collapse();tempSel
hiliLoc[hiliLoc.length]=ge
}
function createHili(t,l,w,h,clr){
var div=parent.frameBottom.doc
div.style.height=h;div.sty
div.style.left=l;div.style
div.style.position="absolu
parent.frameBottom.documen
hiliDiv[hiliDiv.length]=di
}
function clearHili(){
for(i=0;i<hiliDiv.length;i
hiliDiv[i].parentNode.remo
}
if(arguments.length==0){hi
}
function clearBookmarks(){
for(i=0;i<bkmkDiv.length;i
bkmkDiv[i].parentNode.remo
}
bkmkText.length=0;bkmkLoc.
}
function insertBookmark(){
if(!cursorX){alert("Please
var text=prompt("Enter the text:","Bookmark "+(bkmkDiv.length+1));
if(!text){return;}
var img=parent.frameBottom.doc
img.id="bookmark"+bkmkDiv.
img.style.position="absolu
img.style.top=cursorY;
img.style.left=cursorX;
img.innerHTML="<img src='bookmark.gif' title='"+text+"' height=15 unselectable=on>";
img.unselectable="on";
img.onmousedown=function()
parent.frameBottom.documen
bkmkDiv[bkmkDiv.length]=im
bkmkText[bkmkText.length]=
snapToText(img,bkmkLoc.len
}
var offL,offT,drag=false,obj;
function startDrag(srcEl){obj=srcEl
function dragObj(){obj.style.left=x
function getLeft(obj){return parseInt(obj.style.left);}
function getTop(obj){return parseInt(obj.style.top);}
function init(){
var div=parent.frameBottom.doc
div.innerHTML="1";
parent.frameBottom.documen
lineHgt=div.offsetHeight;
div.parentNode.removeChild
}
function getCursorPos(sel){
var pos=parent.frameBottom.doc
pos.moveToElementText(pare
pos.collapse();var cnt=0;
while(!sel.inRange(pos)){
pos.move("character");cnt+
return cnt;
}
function snapToText(img,n){
var start=parent.frameBottom.d
start.moveToElementText(pa
var end=start.duplicate();star
var cnt=0,pos=0,l=parseInt(img
var dif=Math.abs(l-start.bound
while(!end.inRange(start))
start.move("character");cn
thisDif=Math.abs(l-start.b
if(thisDif<dif){pos=cnt;di
}
newsel.move("character",
pos);
img.style.left=newsel.boun
img.style.top=newsel.bound
bkmkLoc[n]=getCursorPos(ne
}
</script>
<body onload="init();"onresize="
<button onclick="hili(parent.frame
<button onclick="clearHili();">Cle
<button onclick="alert(hiliText.jo
<button onclick="alert(hiliLoc.joi
<br>
<button onclick="insertBookmark();
<button onclick="clearBookmarks();
<button onclick="alert(bkmkText.jo
<button onclick="alert(bkmkLoc.joi
<div id=content onclick="cursorX=x;cursorY
Here is some text... Here is some text... Here is some text... Here is some text... Here is some text...
Here is some text... Here is some text... Here is some text... Here is some text... Here is some text...
Here is some text... Here is some text... Here is some text... Here is some text... Here is some text...
Here is some text... Here is some text... Here is some text... Here is some text... Here is some text...
Here is some text... Here is some text... Here is some text... Here is some text... Here is some text...
Here is some text... Here is some text... Here is some text... Here is some text... Here is some text...
</div>
</body>
</html>
HTML for bottom frame:
<html xmlns:o="urn:schemas-micro
xmlns:w="urn:schemas-micro
xmlns="http://www.w3.org/T
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./testing_files/file
<title>testing</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>yrajaram</o:Auth
<o:LastAuthor>yrajaram</o:
<o:Revision>2</o:Revision>
<o:TotalTime>0</o:TotalTim
<o:Created>2004-05-19T01:0
<o:LastSaved>2004-05-19T01
<o:Pages>1</o:Pages>
<o:Company>FileNET Corporation</o:Company>
<o:Lines>1</o:Lines>
<o:Paragraphs>1</o:Paragra
<o:Version>9.3821</o:Versi
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:AttachedTemplate
HRef="C:\Documents and Settings\yrajaram\Applicat
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orpha
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"T
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US style='tab-interval:.5in'>
<div class=Section1>
<p class=MsoNormal>testing</p
</div>
</body>
</html>
Thanks.
Main Topics
Browse All Topics





by: lil_puffballPosted on 2004-05-18 at 15:27:16ID: 11102957
Hi yuvarajr,
Why can you not modify the code in the bottom frame? If it is not on your server, you can't do anything to the page at all.
If it is on your server, then can you post the code for both frames here? It's a lot easier debugging with some code. ;)