Avatar billede the_nest Nybegynder
23. januar 2003 - 22:11 Der er 9 kommentarer og
1 løsning

Frame igen :)

Er ved at lave en side med en bunke iFrames og opdatere dem far main siden... Det er oxo ok i Explore men i NS er det noget helt ande jeg bruger følgende kode:

-Udsnit-
<iframe name="sortId" style="display: inline;" width="600" height="300" frameborder="no" scrolling="Auto" marginwidth="0" marginheight="0"></iframe>
    sortId.document.open("text/html","replace");
    sortId.document.writeln("<html>\n<body bgcolor='#F5F5F5'>");
    sortId.document.writeln("<table width='100%' border='0' cellpadding='0' cellspacing='0'>");
    sortId.document.writeln("    <tr>");
    sortId.document.writeln("        <td>ID:</td>");
    sortId.document.writeln("        <td><a href='#' onMouseUp=\"parent.document.getElementById('sortId').style.display='none'; parent.document.getElementById('sortAlpha').style.display='inline';\">Navn:</a></td>");
    sortId.document.writeln("        <td>Kategori:</td>");
    sortId.document.writeln("        <td>Media:</td>");
    sortId.document.writeln("    </tr>");
    sortId.document.writeln("</table>");
    sortId.document.write("</body>\n<html>");
    sortId.document.close();
-Udsnit-

Jeg søgte lige of fandt at der var et tidliger spørgsmål der omhandlede det sammme emne bare ikke iFrames :)

Håber der er nogle der kan hjælpe...
Avatar billede olebole Juniormester
23. januar 2003 - 22:49 #1
<ole>

Det der virker heller ikke i IE. Den sidste linie:
  sortId.document.write("</body>\n<html>");
vil overskrive hele dokumentet. Men prøv med rigtig syntaks (det virker i begge browsere):

    frames["sortId"].document.open("text/html","replace");
    frames["sortId"].document.writeln("<html>\n<body bgcolor='#F5F5F5'>");
    frames["sortId"].document.writeln("<table width='100%' border='0' cellpadding='0' cellspacing='0'>");
    frames["sortId"].document.writeln("    <tr>");
    frames["sortId"].document.writeln("        <td>ID:</td>");
    frames["sortId"].document.writeln("        <td><a href='#' onMouseUp=\"parent.document.getElementById('sortId').style.display='none'; parent.document.getElementById('sortAlpha').style.display='inline';\">Navn:</a></td>");
    frames["sortId"].document.writeln("        <td>Kategori:</td>");
    frames["sortId"].document.writeln("        <td>Media:</td>");
    frames["sortId"].document.writeln("    </tr>");
    frames["sortId"].document.writeln("</table>");
    frames["sortId"].document.writeln("</body>\n<html>");
    frames["sortId"].document.close();

/mvh
</bole>
Avatar billede olebole Juniormester
23. januar 2003 - 22:53 #2
I øvrigt er det en meget ineffektiv måde at udskrive på. Du bør f.eks. opbygge en streng og skrive den ud til sidst:

var str = "noget tekst";
str += " noget mere tekst";
str += " og en afslutning.";
frames["sortId"].document.open("text/html","replace");
frames["sortId"].document.write( str );
frames["sortId"].document.close();

/mvh
Avatar billede the_nest Nybegynder
23. januar 2003 - 23:08 #3
Hmm det virker nu fint i IE men prøver lige din idé, dumt af mig ikke at bruge 'str+=' !! Havde ikke lige tænkt over den :) Det spare oxo plads til kode.. = hurtiger side :)
Avatar billede the_nest Nybegynder
23. januar 2003 - 23:18 #4
Virker ikke her er lige et udsnit af html.

<iframe name="sortId" style="display: inline;" width="600" height="300" frameborder="no" scrolling="Auto" marginwidth="0" marginheight="0"></iframe>
<iframe name="sortAlpha" style="display: none;" width="600" height="300" frameborder="no" scrolling="Auto" marginwidth="0" marginheight="0"></iframe>
<script language="JavaScript">
// Skriv ID frame
    frames["sortId"].document.open("text/html","replace");
    frames["sortId"].document.writeln("<html>\n<body bgcolor='#F5F5F5'>");
    frames["sortId"].document.writeln("<table width='100%' border='0' cellpadding='0' cellspacing='0'>");
    frames["sortId"].document.writeln("    <tr>");
    frames["sortId"].document.writeln("        <td>ID:</td>");
    frames["sortId"].document.writeln("        <td><a href='#' onMouseUp=\"parent.document.getElementById('sortId').style.display='none'; parent.document.getElementById('sortAlpha').style.display='inline';\">Navn:</a></td>");
    frames["sortId"].document.writeln("        <td>Kategori:</td>");
    frames["sortId"].document.writeln("        <td>Media:</td>");
    frames["sortId"].document.writeln("    </tr>");
    frames["sortId"].document.writeln("    <tr>");
    frames["sortId"].document.writeln("        <td>1</td>");
    frames["sortId"].document.writeln("        <td>Test</td>");
    frames["sortId"].document.writeln("        <td>Film</td>");
    frames["sortId"].document.writeln("        <td>Bånd</td>");
    frames["sortId"].document.writeln("    </tr>");
    frames["sortId"].document.writeln("    <tr>");
    frames["sortId"].document.writeln("        <td>2</td>");
    frames["sortId"].document.writeln("        <td>Alpha Test</td>");
    frames["sortId"].document.writeln("        <td>Billeder</td>");
    frames["sortId"].document.writeln("        <td>DVD</td>");
    frames["sortId"].document.writeln("    </tr>");
    frames["sortId"].document.writeln("</table>");
    frames["sortId"].document.writeln("</body>\n<html>");
    frames["sortId"].document.close();
// Skriv Alpa frame
    frames["sortAlpha"].document.open("text/html","replace");
    frames["sortAlpha"].document.writeln("<html>\n<body bgcolor='#F5F5F5'>");
    frames["sortAlpha"].document.writeln("<table width='100%' border='0' cellpadding='0' cellspacing='0'>");
    frames["sortAlpha"].document.writeln("    <tr>");
    frames["sortAlpha"].document.writeln("        <td><a href='#' onMouseUp=\"parent.document.getElementById('sortAlpha').style.display='none'; parent.document.getElementById('sortId').style.display='inline';\">ID:</a></td>");
    frames["sortAlpha"].document.writeln("        <td>Navn:</td>");
    frames["sortAlpha"].document.writeln("        <td>Kategori:</td>");
    frames["sortAlpha"].document.writeln("        <td>Media:</td>");
    frames["sortAlpha"].document.writeln("    </tr>");
    frames["sortAlpha"].document.writeln("    <tr>");
    frames["sortAlpha"].document.writeln("        <td>2</td>");
    frames["sortAlpha"].document.writeln("        <td>Alpha Test</td>");
    frames["sortAlpha"].document.writeln("        <td>Billeder</td>");
    frames["sortAlpha"].document.writeln("        <td>DVD</td>");
    frames["sortAlpha"].document.writeln("    </tr>");
    frames["sortAlpha"].document.writeln("    <tr>");
    frames["sortAlpha"].document.writeln("        <td>1</td>");
    frames["sortAlpha"].document.writeln("        <td>Test</td>");
    frames["sortAlpha"].document.writeln("        <td>Film</td>");
    frames["sortAlpha"].document.writeln("        <td>Bånd</td>");
    frames["sortAlpha"].document.writeln("    </tr>");
    frames["sortAlpha"].document.writeln("</table>");
    frames["sortAlpha"].document.writeln("</body>\n<html>");
    frames["sortAlpha"].document.close();
</script>
Avatar billede the_nest Nybegynder
23. januar 2003 - 23:23 #5
Laver lige en string ver :)

Der er næsten ingen forskeld på write og writeln (DevGuru):

write Method
This method is used to write HTML expressions to the specified document.

Syntax: document.write("expression(s)")

writeln Method
This method is identical to the write method detailed above, with the addition of writing a new line character after any specified expressions.

Syntax: document.writeln("expression(s)")
Avatar billede the_nest Nybegynder
23. januar 2003 - 23:30 #6
Hved godt der oxo er andre steder jeg kan spare på kode men kan godt lide det nice ud, gør det oxo mere overskuelig :)
Avatar billede olebole Juniormester
23. januar 2003 - 23:35 #7
Nej, det virker ikke. Du skal lægge alt dit skriveri ind i en funktion og vente ganske kort med at kalde den:

<iframe src="about:blank" name="sortId" style="display: inline;" width="600" height="300" frameborder="no" scrolling="Auto" marginwidth="0" marginheight="0"></iframe>

<iframe src="about:blank" name="sortAlpha" style="display: none;" width="600" height="300" frameborder="no" scrolling="Auto" marginwidth="0" marginheight="0"></iframe>

<script type="text/JavaScript">
function skrivDaShit() {
  // Hele din skrive-kode her
}
setTimeout( "skrivDaShit()", 100 );
</script>

Så kører det  ;o)
/mvh
Avatar billede the_nest Nybegynder
23. januar 2003 - 23:51 #8
Tjep så virker det der er kun et men, den pause gør at der lige nå at blive en hvid firkant der hvor framet kommer en hvid firkant, men tror endlig bare jeg gæmmer iFramet væk til det er loadet :)
Avatar billede olebole Juniormester
24. januar 2003 - 00:06 #9
<iframe src="about:blank" id="sortId" name="sortId" style="display: inline;visibility:hidden;" width="600" height="300" frameborder="no" scrolling="Auto" marginwidth="0" marginheight="0"></iframe>

<script type="text/JavaScript">
function skrivDaShit() {
  // Hele din skrive-kode her
  document.getElementById("sortId").style.visibility = "visible";
}
setTimeout( "skrivDaShit()", 100 );
</script>

Men husk at tildele iframe'en en id  ;o)
/mvh
Avatar billede the_nest Nybegynder
24. januar 2003 - 00:10 #10
Har lavet et nyt spørgsmål, hmm jeg bruger CSS elementet display til at vise iFramet med, med følgende probs: inline og none

Men virker ikke i NS
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester

Seneste spørgsmål Seneste aktivitet
I går 21:00 Libre Office Impress Af Frank i Andre styresystemer
I går 11:47 VB script Af Jenshentze i Word
I går 11:21 Popup ved opstart Af mort1 i Windows
04/0918:50 Slet lokal konto Af ErikHg i Windows
04/0916:05 Ændre tal i en celle Af xvid i Excel