Avatar billede iggipop Nybegynder
13. januar 2004 - 21:28 Der er 15 kommentarer

Hjælp til refresh

Hej !

Jeg har intet forstand på javascript, men en ven har hjulpet med denne function

function addIndhold(strTekst)
{
    idContent.document.body.innerHTML = strTekst;
    parent.idContent.location.reload(true);
    return true;
}   

Dog virker den linie med reload ikke. Den skal refreshe siden eller det felt eller hvad det nu hedder på java'esk :D
Kan I se hvad der er galt...han er nemlig gået lidt i stå :D
Avatar billede nute Nybegynder
13. januar 2004 - 21:49 #1
hva er 'idContent' ? er det en frame ?

hvis det er en frame på den siden som scriptet ligger på, så prøv å skift denne linje:

parent.idContent.location.reload(true);

med denne:

document.frames[ 'idContent' ].document.location.reload( true );

hvis du skal refreshe den samme side som scriptet ligger så, så bruger du

document.location.reload( true );

/nute
Avatar billede iggipop Nybegynder
13. januar 2004 - 21:51 #2
idcontent er en iframe tror jeg....
Vil du se hele siden som det ligger i ?
Avatar billede iggipop Nybegynder
13. januar 2004 - 21:54 #3
den første virker ik og nummer 2 linie refresher siden i det uendelige
Avatar billede iggipop Nybegynder
13. januar 2004 - 21:58 #4
<% Session.LCID=1030 %>
<%
if isEmpty(session("UserID")) then
    Response.Redirect "../../bruger/asp/logadmin.asp?msg=" & Server.URLEncode ("Du skal være logget ind for at indtaste fangstrapporter.")
end if
%>
<%
msg= request.querystring("msg")
overskrift= request.querystring("overskrift")
forfatter= request.querystring("forfatter")
fangstmnd= request.querystring("fangstmnd")
fangst= request.querystring("fangst")
agn= request.querystring("agn")
vaegt= request.querystring("vaegt")
kategori= request.querystring("kategori")
sted= request.querystring("sted")
beretning= request.querystring("beretning")
'beretning = replace(beretning,"&lt;","<")

%>
<html>

  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta http-equiv="Cache-Control" content="no-store">
<meta http-equiv="Pragma" content="no-cache">

    <link rel="stylesheet" type="text/css" href="fiskestil.css">
    <style TYPE="text/css">
TABLE#tblCoolbar
    {
    background-color:threedface; padding:1px; color:menutext;
    border-width:1px; border-style:solid;
    border-color:threedhighlight threedshadow threedshadow threedhighlight;
    }
.cbtn
    {
    height:18;
    BORDER-LEFT: threedface 1px solid;
    BORDER-RIGHT: threedface 1px solid;
    BORDER-TOP: threedface 1px solid;
    BORDER-BOTTOM: threedface 1px solid;
    }
.txtbtn {font-family:tahoma; font-size:70%; color:menutext;}
</style>
<script LANGUAGE="JavaScript">
function button_over(eButton)
    {
    eButton.style.backgroundColor = "#B5BDD6";
    eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
    }
function button_out(eButton)
    {
    eButton.style.backgroundColor = "threedface";
    eButton.style.borderColor = "threedface";
    }
function button_down(eButton)
    {
    eButton.style.backgroundColor = "#8494B5";
    eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
    }
function button_up(eButton)
    {
    eButton.style.backgroundColor = "#B5BDD6";
    eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
    eButton = null;
    }


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

var isHTMLMode=false

function document.onreadystatechange()
    {
      idContent.document.designMode="On"
    }
function cmdExec(cmd,opt)
    {
      if (isHTMLMode){alert("Please uncheck 'Edit HTML'");return;}
      idContent.document.execCommand(cmd,"",opt);idContent.focus();
    }
function setMode(bMode)
    {
    var sTmp;
      isHTMLMode = bMode;
      if (isHTMLMode){sTmp=idContent.document.body.innerHTML;idContent.document.body.innerText=sTmp;}
    else {sTmp=idContent.document.body.innerText;idContent.document.body.innerHTML=sTmp;}
      idContent.focus();
    }
function createLink()
    {
    if (isHTMLMode){alert("Please uncheck 'Edit HTML'");return;}
    cmdExec("CreateLink");
    }
function insertImage()
    {
    if (isHTMLMode){alert("Please uncheck 'Edit HTML'");return;}
    var sImgSrc=prompt("Insert Image File (You can use your local image file) : ", "http://www.aspalliance.com/Yusuf/sample.jpg");
    if(sImgSrc!=null) cmdExec("InsertImage",sImgSrc);
    }
function Save()
    {
    if (isHTMLMode){alert("Please uncheck 'Edit HTML'");return;}
      var sImgTag = idContent.document.body.all.tags("IMG");
      var oImg;
      for (var i = sImgTag.length - 1; i >= 0; i--)
        {
        oImg = sImgTag[i];
        alert("Add your code to Upload Local Image file here. Image inserted : " + oImg.src );
          }
      alert("Add your code to Save Document here");
      alert("Your Document : " + idContent.document.body.innerHTML);
    }
function foreColor()
{
    var arr = showModalDialog("selcolor.htm","","font-family:Verdana; font-size:12; dialogWidth:30em; dialogHeight:34em" );
    if (arr != null) cmdExec("ForeColor",arr);   
    }
function flytIndhold()
{
    document.minform.indhold.value = idContent.document.body.innerHTML
    return true
}

function addIndhold(strTekst)
{
    idContent.document.body.innerHTML = strTekst;
    parent.idContent.location.reload(true);
    return true;
}   
   
</script>

  </head>

    <body bgcolor="#F9F9F9" onload="addIndhold('<%=request.queryString("beretning")%>')">

<div align="center">
  <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="530" id="AutoNumber2">
      <tr>
        <td width="100%">
          <p align="center">
            <font face="Verdana" size="2">
              <strong>
                Indtast fangstrapport
              </strong>
            </font>
          </p>
        </td>
      </tr>
        <tr>
          <td width="100%">
            <hr width="530px">
          </td>
        </tr>
        <tr>
          <td width="100%" align=center>
            <%
            Response.write "<FONT size=1 face=verdana><b>" & (msg) & "</b></FONT>"
            %>
          </td>
        </tr>
    </table>
  </center>
</div>


<br>

<form method="POST" name="minform" action="add_report.asp" onSubmit="return flytIndhold()">
<INPUT TYPE="hidden" name="indhold">

<div align="center">
  <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="530" id="AutoNumber2">
      <tr>
        <td width="100%">
          <p align="left">
            <font face="Verdana" size="1">
              <strong>
                <a href="view_select_bg.asp">
                  Tilbage
                </a>
              </strong>
            </font>
          </p>
        </td>
      </tr>
    </table>
  </center>
</div>
<br>
<div align="center">
    <table border="0" cellpadding="0" cellspacing="0" width="530" id="table2" bordercolor="#000000" style="border-left-width: 0px; border-right-width: 0px; border-top-width: 0px">
        <tr>
            <td class="fangsttekst" rowspan="5" width="20%" style="border-left: medium none #000000; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #000000">
            </td>
            <td class="fangsttekst" width="20%" style="border-style: none; border-width: medium">
            <b>Overskrift:</b></td>
            <td class="fangsttekst" style="border-style: none; border-width: medium" >:<input type="text" name="overskrift" size="30" value="<%=overskrift%>" style="border-left: medium none; border-right: medium none; border-top: medium none; border-style: dotted; border-width: 1; background-color: #F9F9F9"></td>
        </tr>
        <tr>
            <td class="fangsttekst" width="20%" style="border-style: none; border-width: medium">Navn</td>
            <td class="fangsttekst" style="border-style: none; border-width: medium" >:<input type="text" name="Forfatter" size="30" value="<%=forfatter%>" style="border-style: dotted; border-width: 1; background-color: #F9F9F9"></td>
        </tr>
        <tr>
            <td class="fangsttekst" width="20%" style="border-style: none; border-width: medium">Dato for fangst</td>
            <td class="fangsttekst" style="border-style: none; border-width: medium" >:<input type="text" name="fangstmnd" value="<%=fangstmnd%>" size="10" style="border-style: dotted; border-width: 1; background-color: #F9F9F9">dd-mm-aaaa
            </td>
        </tr>
                <tr>
            <td class="fangsttekst" width="20%" style="border-style: none; border-width: medium">Fangst</td>
            <td class="fangsttekst" style="border-style: none; border-width: medium" >:<select name="fangst" size="1" style="border-style: dotted; border-width: 1; background-color: #F9F9F9">>
    <option><%=fangst%></option>
    <option>Aborre</option>
    <option>Barracuda</option>
    <option>Brasen</option>
    <option>Brosme</option>
    <option>Bækørred</option>
    <option>Gedde</option>
    <option>Grouper</option>
    <option>Græskarpe</option>
    <option>Havkat</option>
    <option>Havørred</option>
    <option>Helt</option>
    <option>Hornfisk</option>
    <option>Issing</option>
    <option>Kildeørred</option>
    <option>Kuller</option>
    <option>Ladyfish</option>
    <option>Laks</option>
    <option>Lange</option>
    <option>Makrel</option>
    <option>Marlin</option>
    <option>Multe</option>
    <option>Pighvar</option>
    <option>Redsnapper</option>
    <option>Regnbueørred</option>
    <option>Rokke</option>
    <option>Rødfisk</option>
    <option>Sailfish</option>
    <option>Sej</option>
    <option>Sild</option>
    <option>Skalle</option>
    <option>Skælkarpe</option>
    <option>Slethvar</option>
    <option>Spejlkarpe</option>
    <option>Stenbidder</option>
    <option>Suder</option>
    <option>Sværdfisk</option>
    <option>Søørred</option>
    <option>Torsk</option>
    <option>Tun</option>
    <option>Ål</option>
    </select>
            </td>
        </tr>
        <tr>
            <td class="fangsttekst" width="20%" style="border-style: none; border-width: medium">Agn</td>
            <td class="fangsttekst" style="border-style: none; border-width: medium" >:<input type="text" name="agn" size="10" value="<%=agn%>" style="border-style: dotted; border-width: 1; background-color: #F9F9F9"></td>
        </tr>
    </table>
</div>
<br>
<div align="center">
    <table border="1" cellpadding="0" cellspacing="0" style="border-width:0px; border-collapse: collapse; " width="530" id="table2" bordercolor="#000000">

            <tr>
            <td class="fangsttekst" width="33%" style="border-style:none; border-width:medium; ">
            Vægt i kg:<br><input type="text" name="vaegt" size="7" value="<%=vaegt%>" style="border-style: dotted; border-width: 1; background-color: #F9F9F9">     
   
            </td>
            <td class="fangsttekst" width="33%" style="border-top:medium none #000000; border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium">
            Kategori:<br>
            <select name="metode" size="1" style="border-style: dotted; border-width: 1; background-color: #F9F9F9">
    <option><%=kategori%></option>
    <option>Havfiskeri</option>
    <option>Kystfiskeri</option>
    <option>Medefiskeri</option>
    <option>Søfiskeri</option>
    <option>Mosefiskeri</option>
    <option>Åfiskeri</option>
    <option>Put &amp; Take</option>
    <option>Trolling</option>
    <option>Elv</option>
    <option>Udlandet</option>
    <option>Fjord</option>
    </select>
   
            </td>
            <td class="fangsttekst" width="33%" style="border-top:medium none #000000; border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium">
            Sted:<br>
            <input type="text" name="sted" size="20" value="<%=sted%>" style="border-style: dotted; border-width: 1; background-color: #F9F9F9">
            </td>
        </tr>
<tr>
<td class="fangsttekst" style="border-left:1px none #000000; border-right:1px none #000000; border-top-style:none; border-top-width:medium; border-bottom-style:none; border-bottom-width:medium" colspan="3">
Beretning:
</td>
</tr>
</table>
  </center>
</div>

<TABLE align=center bgcolor="#f0f8ff" style="border:0px solid darkblue; FONT-FAMILY: verdana" >
<table id="tblCoolbar" width="530" cellpadding="0" cellspacing="0" align=center>
<tr valign="middle">

    <td colspan="16">
                <select onchange="cmdExec('fontname',this[this.selectedIndex].value);">
            <option selected>Font</option>
            <option value="Arial">Arial</option>
            <option value="Arial Black">Arial Black</option>
            <option value="Arial Narrow">Arial Narrow</option>
            <option value="Comic Sans MS">Comic Sans MS</option>
            <option value="Courier New">Courier New</option>
            <option value="System">System</option>
            <option value="Tahoma">Tahoma</option>
            <option value="Times New Roman">Times New Roman</option>
            <option value="Verdana">Verdana</option>
            <option value="Wingdings">Wingdings</option>
        </select>
        <select onchange="cmdExec('fontsize',this[this.selectedIndex].value);">
            <option selected>Size</option>
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
            <option value="7">7</option>
            <option value="8">8</option>
            <option value="10">10</option>
            <option value="12">12</option>
            <option value="14">14</option>
        </select>
       
    </td>
   
</tr>
<tr>

    <td><div class="cbtn" onClick="cmdExec('cut')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Cut.gif" alt="Cut" WIDTH="23" HEIGHT="22">
    </div></td>
   
    <td><div class="cbtn" onClick="cmdExec('copy')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Copy.gif" alt="Copy" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('paste')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Paste.gif" alt="Paste" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('bold')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Bold.gif" alt="Bold" WIDTH="23" HEIGHT="22">
    </div></td>
   
    <td><div class="cbtn" onClick="cmdExec('italic')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Italic.gif" alt="Italic" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('underline')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Under.gif" alt="Underline" WIDTH="23" HEIGHT="22">
    </div></td>       
       
    <td><div class="cbtn" onClick="cmdExec('justifyleft')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Left.gif" alt="Justify Left" WIDTH="23" HEIGHT="22">
    </div></td>
   
    <td><div class="cbtn" onClick="cmdExec('justifycenter')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Center.gif" alt="Center" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('justifyright')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Right.gif" alt="Justify Right" WIDTH="23" HEIGHT="22">
    </div></td>       
   
    <td><div class="cbtn" onClick="cmdExec('insertorderedlist')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/numlist.GIF" alt="Ordered List" WIDTH="23" HEIGHT="22">
    </div></td>   

    <td><div class="cbtn" onClick="cmdExec('insertunorderedlist')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/bullist.GIF" alt="Unordered List" WIDTH="23" HEIGHT="22">
    </div></td>
       
    <td><div class="cbtn" onClick="cmdExec('outdent')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/deindent.gif" alt="Decrease Indent" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('indent')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/inindent.gif" alt="Increase Indent" WIDTH="23" HEIGHT="22">
    </div></td>           
   
   
   
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" align=center>
    <tr>
        <td align=center><iframe width="530" id="idContent" height="150" ></iframe>
</td>
    </tr>
    <tr>
        <td align=center>   
</td>
    </tr>


</table>
<div align="center">
<table border="0" cellpadding="0" style="border-collapse: collapse" width="530" id="table3" bordercolor="#000000">

<tr>
    <td colspan="5" style="border-bottom-style: none; border-bottom-width: medium"> 
    &nbsp;</td>
    </tr>

    <tr>
    <td colspan="5" class="fangsttekst" style="border-style: none; border-width: medium"> 
<p align="center"> 
Sæt hak hvis du vil se HTML-tags<input type="checkbox" onclick="setMode(this.checked)">
</td>
</tr>
    <tr>
    <td colspan="5" class="fangsttekst" style="border-style: none; border-width: medium"> 
<p align="center"> 
<b>Hvis du vil uploade billede til denne rapport skal du sætte hak her:</b><input type="checkbox" name="billede" >
            </td>

    </tr>
<tr>
    <td colspan="5" style="border-bottom-style: none; border-bottom-width: medium"> 
    &nbsp;</td>
    </tr>


    <tr>
    <td colspan="5" class="fangsttekst" style="border-style: none; border-width: medium"> 
<p align="center"> 
<p align=center><input type="submit" value="Gem rapport" name="B1"></p>

</td>

</tr>
</table>
</div>

<script>
        //idContent.document.write ("")
        //idContent.document.body.innerHTML = "123"
        idContent.document.close()

</script>
  </p>
</FORM>
</TD>
</TR>
</TABLE>

</body>
</html>
Avatar billede nute Nybegynder
13. januar 2004 - 22:01 #5
så prøv med

idContent.document.location.reload(true);

/nute
Avatar billede iggipop Nybegynder
14. januar 2004 - 09:56 #6
Nope...virker ik...
Den kommer med fejl i browseren nederst som siger :
idcontent.document.body er NULL eller ikke et object
Avatar billede nute Nybegynder
14. januar 2004 - 10:40 #7
hmm ... den fejl har jo ikke noget med reload'en at gøre. Fejlen peger på linjen før selve reload'en. Prøv denne istedet, og se om ikke denne gør det du skal:


function addIndhold(strTekst)
{
    idContent.document.open();
      idContent.document.write(strTekst);
      idContent.document.close();
      idContent.document.location.reload(true);
    return true;


/nute
Avatar billede iggipop Nybegynder
14. januar 2004 - 11:36 #8
muhahahaha...nu virker det sgu....KANON mand...
Tusind tak for hjælpen...var lige ved at opgive!!
Avatar billede iggipop Nybegynder
14. januar 2004 - 11:36 #9
Smid et svar
Avatar billede nute Nybegynder
14. januar 2004 - 11:40 #10
jeg var også lige ved at opgive ... *rødme*

men det var godt ... fino !!

;-)
Avatar billede iggipop Nybegynder
14. januar 2004 - 12:01 #11
Hehe..godt du ikke gjorde :D
Mange taak!
Avatar billede iggipop Nybegynder
14. januar 2004 - 12:10 #12
Et hurtigt tillægsspørgsmål...
Kan du se ud af koden hvad der bliver standard skrifttype og størrelse i feltet hvis ikke det ændres ? Og hvis ja..hvor står det så ?
Avatar billede nute Nybegynder
14. januar 2004 - 12:41 #13
det bliver ikke sat nogen standard skrifttype eller størrelse. og jeg kan ikke lige umiddelbart se hvilken font der bliver brugt. JEg ville tro det er en Arial type, men nu er jeg ikke den der har så meget styr på fonter ...

/nute
Avatar billede iggipop Nybegynder
14. januar 2004 - 12:50 #14
Oki.....thanx anyway :D
Avatar billede nute Nybegynder
14. januar 2004 - 12:52 #15
no problemo ... anytime
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