Click to See Complete Forum and Search --> : document.write() and frames again


rpgbuster
01-23-2003, 02:36 PM
i have 2 frames, "frame2" writes to "frame1". how can i clear "frame1" before more text is added? the way it is now, it just keeps adding the text into one large Paragraph. Thanks.

Webskater
01-23-2003, 02:40 PM
Post your code.

rpgbuster
01-23-2003, 02:57 PM
<HTML>
<Head>

</Head>
<Body Bgcolor="#000000">
<Center><IMG Src="1.jpg" Name="changer"></Center>
<P>
<a href="javascript:firstslide()"><img SRC="first.gif" BORDER=0 height=28 width=40></a>

<a href="javascript:prevslide()"><img SRC="prev.gif" BORDER=0 height=28 width=40></a>

<a href="javascript:nextslide()"><img SRC="next.gif" BORDER=0 height=28 width=40></a>

<a href="javascript:lastslide()"><img SRC="last.gif" BORDER=0 height=28 width=40></a>

<script language="JavaScript">
// Browser checker
Browser_Name = navigator.appName;
Browser_Ver = parseInt(navigator.appVersion);
if((Browser_Name == "Netscape" && Browser_Ver >= 3) || (Browser_Name == "Microsoft Internet Explorer" && Browser_Ver >= 4)) Browser_Gen = ">=3rd";
else Browser_Gen = "<3rd";

if (Browser_Gen == '>=3rd') {


num_of_slides = 5; // Declare the number of slides in your show
slide_num = 5; // Which slide loads ups first

var rant= new Array(5)
rant[1] = "create"
rant[2] = "yay"
rant[3] = "WAI!"
rant[4] = "Ja"
rant[5] = "YO!"

var path= new Array(5)
path[1] = "1.jpg"
path[2] = "2.gif"
path[3] = "3.jpg"
path[4] = "4.gif"
path[5] = "5.jpg"

function firstslide(){
slide_num = num_of_slides;
changeslide();
}
function prevslide(){
slide_num= slide_num + 1;
}
changeslide();
}
function nextslide(){
slide_num = slide_num - 1;
if(slide_num < num_of_slides){
slide_num = num_of_slides
}
changeslide();
}
function lastslide(){
slide_num = 1;
changeslide();
}

function changeslide(){

// Changes the slide
eval('document.changer.src = path[slide_num]');

// Changes the rant
parent.frames["frame1"].document.write('<html><body bgcolor=/"#000000/" text=/"#ffffff/">' + eval('rant[' + slide_num +']'));
}
// end hiding contents -->
</script>
</Body>
</HTML>

Webskater
01-23-2003, 03:11 PM
// Changes the rant
parent.frames["frame1"].document.write('<html><body bgcolor=/"#000000/" text=/"#ffffff/">' + eval('rant[' + slide_num +']'));
}

How I would do this is write the text in frame1 to something I could give an id to like a div tag or span tag.
<span id=ranttext></span>

Then you set the value of the span tag to an empty string which clears anything already in there.
parent.frames['frame1'].ranttext.innerHTML = ""

Then you write your new text
parent.frames['frame1'].ranttext.innerHTML = your stuff as above.

rpgbuster
01-23-2003, 03:23 PM
Thanks for all your help! It works now!:D