Avatar billede freud Nybegynder
01. juni 2004 - 21:57 Der er 4 kommentarer og
1 løsning

indsæt var i streng

Har følgende kode:

function createFullURL(target, sUrl ) {

myEditor.loadDoc("<a target=\""+target+"\" href=\""+sUrl+"\"> XXX);
    }

Jeg ønsker XXX udskiftet med følgende variable:

var neocon = document.all.url.value;


Men hvordan gør jeg det ????
Avatar billede roenving Novice
01. juni 2004 - 22:02 #1
Øeh, forstår ik' li'e hvad du vil ...

myEditor.loadDoc("<a target=\""+target+"\" href=\""+sUrl+"\">"+ neocon);

eller måske:

myEditor.loadDoc("<a target=\""+target+"\" href=\""+sUrl+"\">" + document.getElementById('url').value);
Avatar billede freud Nybegynder
01. juni 2004 - 22:17 #2
se her:

http://www.neocon.dk/kunder/neocon_admin/editor_neocon.asp

Funktionen som skal laves om er link.

Jeg kan godt få det med at lave et link til at virke, men den tekst som jeg
markeder bliver skiftet ud med en ande.......

Det jeg gerne vil have at der skal der, er selvfølgelig at den tekst som jeg
markere og som skal bruges link - skal være den tekst som jeg har markedet

R det til at forstå... ved ik rigtig hvordan jeg skal forklare det :-)
Avatar billede freud Nybegynder
01. juni 2004 - 22:18 #3
måske det skal løses på en anden måde end med en var , men hvad ved jeg
kan ik finde ud af det med js :-)
Avatar billede freud Nybegynder
02. juni 2004 - 14:16 #4
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<SCRIPT>
<!--
var display_window = window.open('http://www.krogh-thomsen.dk/pix/sideindhold/test.asp','display_window','resizable=yes,height=400,width=550');display_window.window.focus();


function viewImage(){
    display_window.document.image_main.src= document.all.prefix.value + document.all.imagebank.value;   
    display_window.window.focus();
}

//toevoeging code Open Window Petrov

function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
  var leftPos,topPos,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340; 
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
    if (document.all || document.layers || document.getElementById) {
      w = screen.availWidth; h = screen.availHeight;}
      leftPos = (winAlign == "center" || winAlign == "topcenter" || winAlign == "bottomcenter" ) ? (w-popWidth)/2 : 0;
      topPos = (winAlign == "center" || winAlign == "leftcenter" || winAlign == "rightcenter" ) ? (h-popHeight)/2 : 0;
      features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  if (window["popupWindow"] == null) window["popupWindow"] = new Array();
  var wp = popupWindow.length;
  popupWindow[wp] = window.open(theURL,winName,features);
  if (popupWindow[wp].opener == null) popupWindow[wp].opener = self; 
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
        ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
        popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
        popupWindow[wp].document.body.onbeforeunload = function() {
              if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
            window.onbeforeunload = null;    } 
          autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
      window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; } 
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}

function buildColorTriplet (r, g, b) {
  r = r.toString(16).toUpperCase();
  if (r.length == 1)
    r = '0' + r;
  g = g.toString(16).toUpperCase();
  if (g.length == 1)
    g = '0' + g;
  b = b.toString(16).toUpperCase();
  if (b.length == 1)
    b = '0' + b;
  return '#' + r + g + b;
}

function buildColorTable(div,inc) {
    var i = 0;
    var html = '';
    for (var r = 255; r >= 0; r -= inc)
      for (var g = 255; g >= 0; g -= inc)
        for (var b = 255; b >= 0; b -= inc) {
          var color = buildColorTriplet (r, g, b);
          html += '<TD BGCOLOR="' + color + '" width="12"><img class="clsCursor" src="images/1pix.gif" height=8 width=10 border=0 onClick="ColorPalette_OnClick(\'' + color + '\')"><\/TD>';
          i++;
          if (i % div == 0) {
            html = '<TR>' + html + '<\/TR>';
            document.write(html);
            html = '';
          }
        }
    if (html != '')
        document.write(html);   
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<style type="text/css">
<!--
-->
</style>
<link href="../../css/style.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" rightmargin="0">
<form name="fHtmlEditor" method="POST" action="oversigt_indhold.asp?ID=&opdater=ok">
<p><style type="text/css">
<!--
.clsCursor {  cursor: hand}

-->
</style>
          <textarea name="EditorValue" class="text_box" style="display: none;">demo indholds tekst</textarea>
          <script language="JavaScript">

  var errorString = "Sorry but this web page needs\nWindows95 and Internet Explorer 5 or above to view."
  var Ok = "false";
  var name =  navigator.appName;
  var version =  parseFloat(navigator.appVersion);
  var platform = navigator.platform;

    if (platform == "Win32" && name == "Microsoft Internet Explorer" && version >= 4){
        Ok = "true";
    } else {
        Ok= "false";
    }

    if (Ok == "false") {
        alert(errorString);
    }

function ColorPalette_OnClick(colorString){
   
    cpick.bgColor=colorString;
    document.all.colourp.value=colorString;
    doFormat('ForeColor',colorString);
}

function initToolBar(ed) {
   
    var eb = document.all.editbar;
    if (ed!=null) {
        eb._editor = window.frames['myEditor'];
    }
}

function doFormat(what) {

    var eb = document.all.editbar;

    if(what == "FontName"){
        if(arguments[1] != 0){
            eb._editor.execCommand(what, arguments[1]);
            document.all.font.selectedIndex = 0;
       
        }
    } else if(what == "FontSize"){
    if(arguments[1] != 0){
      eb._editor.execCommand(what, arguments[1]);
      document.all.size.selectedIndex = 0;
    }
    } else {
        /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
            //eb._editor.execCommand(what, arguments[1]);
        /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/       
    }
}

    /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
    function createFullURL(target, sUrl, neo ) {
        myEditor.loadDoc("<a target=\""+target+"\" href=\""+sUrl+"\">"+ neo +" );
    }
    /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

function swapMode() {

    var eb = document.all.editbar._editor;
  eb.swapModes();
}

function create() {

    var eb = document.all.editbar;
    eb._editor.newDocument();
}

function newFile(){

    create();
}

function makeUrl(){
       
    sUrl = document.all.what.value + document.all.url.value;
   
    var neocon = document.all.url.value;
    /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
    //Kald til metode der sammensætter URL
    tempTarget = document.all.target.value;
    createFullURL(tempTarget,sUrl, neocon);
    /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
   
   
    /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
    //doFormat('CreateLink',sUrl);
    /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
}

function createImage(){

    sImage = document.all.prefix.value + document.all.imagebank.value;
    doFormat('InsertImage',sImage);
}

function copyValue() {

    var theHtml = "" + document.frames("myEditor").document.frames("textEdit").document.body.innerHTML + "";
    document.all.EditorValue.value = theHtml;
}

function SwapView_OnClick(){

  if(document.all.btnSwapView.value == "View Html"){
        var sMes = "View Wysiwyg";
    var sStatusBarMes = "NeoCon.Admin: Html";
    } else {
        var sMes = "View Html"
    var sStatusBarMes = "NeoCon.Admin: Editor";
  }
   
    document.all.btnSwapView.value = sMes;
  window.status  = sStatusBarMes;
    swapMode();
}

function Help_OnClick(){
  window.open("editor_images/help_document.htm","wHelp", "toolbar=0, scrollbars=yes, width=640, height=480");
}

function OnFormSubmit(){

  if(confirm("Dokumentet er ved at blive gemt\nEr du færdig med dine ændringer?")){
    copyValue();
    document.fHtmlEditor.submit();
  }
}
</script>
<table border="0" align="center" cellpadding="0" cellspacing="0">
                <tr valign="top">
                  <td valign="top">
                    <div id=editbar >
                      <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                        <tr>
                          <td align="left" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="100%">
                              <tr>
                              <td>                                  <table border="0" cellpadding="3" cellspacing="3">
                                    <tr>
                                      <td align="left" valign="baseline" nowrap>                                          <div align="left">
                                    <img class='clsCursor' src="editor_images/Bold.gif" width="16" height="16" border="0" align="absmiddle" alt="Fed" onClick="doFormat('Bold')">
                                    &nbsp;<img class='clsCursor' src="editor_images/Italics.gif" width="16" height="16" border="0" align="absmiddle" alt="Kursiv" onClick="doFormat('Italic')">
                                    &nbsp;<img class='clsCursor' src="editor_images/underline.gif" width="16" height="16" border="0" align="absmiddle" alt="Understregning" onClick="doFormat('Underline')" >
                                    &nbsp;<select name="size" onChange="doFormat('FontSize',document.all.size.value);" style="font: 8pt verdana;">
                                      <option value="None">St&oslash;rrelse
                                      <option value="1">1
                                      <option value="2">2
                                      <option value="3">3
                                      <option value="4">4
                                      <option value="5">5
                                      <option value="6">6
                                      <option value="7">7
                                      <option value="+1">+1
                                      <option value="+2">+2
                                      <option value="+3">+3
                                      <option value="+4">+4
                                      <option value="+5">+5
                                      <option value="+6">+6
                                      <option value="+7">+7                                     
                                      </select>
                                    &nbsp;<img class='clsCursor' src="editor_images/left.gif" width="16" height="16" border="0" alt="Juster til venstre" align="absmiddle"  onClick="doFormat('JustifyLeft')">
                                    &nbsp;<img class='clsCursor' src="editor_images/centre.gif" width="16" height="16" border="0" alt="Centreret" align="absmiddle" onClick="doFormat('JustifyCenter')">
                                    &nbsp;<img class='clsCursor' src="editor_images/right.gif" width="16" height="16" border="0" alt="Højrejuster" align="absmiddle"  onClick="doFormat('JustifyRight')">
                                    &nbsp;<img class='clsCursor' src="editor_images/para_bul.gif" width="16" height="16" border="0" alt="Opstilling med punkt tegn" onClick="doFormat('InsertUnorderedList');" >
                                    &nbsp;<img class='clsCursor' src="editor_images/para_num.gif" width="16" height="16" border="0" alt="Opstilling med tal" onClick="doFormat('InsertOrderedList');" >
                                    &nbsp;<img class='clsCursor' src="editor_images/indent.gif" width="20" height="16" alt="Formindsk indrykning" onClick="doFormat('Indent')">
                                    &nbsp;<img class='clsCursor' src="editor_images/outdent.gif" width="20" height="16" alt="Forøg indrykning" onClick="doFormat('Outdent')">
                                    &nbsp;<img class='clsCursor' src="editor_images/hr.gif" width="16" height="18" alt="Indsæt linie" onClick="doFormat('InsertHorizontalRule')">
                                      </div>
                                      </td>
                                    </tr>
                                  </table>
                                  <table width="100%" border="0" cellpadding="3" cellspacing="3">
                                    <tr>
                                      <td>
                                      <input type="hidden" name="prefix" value="http://www.krogh-thomsen.dk/pix/sideindhold/">
                                        <select name="imagebank" style="font: 8pt verdana;">
                                        <option value="">VÆLG BILLEDE...</option>
                                       
                                        <option value="">
                                          - &nbsp;
                                        </option>
                                       
                                        </select>
                                        <input type="button" name="addimage" value="Tilf&oslash;j" onClick="createImage();" style="font: 8pt verdana;">
                                        <input type="button" name="viewimage" value="Se billede" onClick="viewImage();" style="font: 8pt verdana;">
                                        <br>
</td>
                                    </tr>
                                    <tr>
                                      <td>
                                        <select name="what" style="font: 8pt verdana;">
                                        <option value="http://" selected>http://
                                        <option value="mailto:">mailto:
                                        <option value="ftp://">ftp://                                       
                                        </select>
                                        <input type="text" name="url" size="26" style="font: 8pt verdana;">
                                       
                                        <select name="target" style="font: 8pt verdana;">
                                        <option value="_blank">Åbn i nyt vindue
                                        <option value="_self">Åbn i samme vindue
                                        <option value="_top">Ånber et nyt vindue ovenpå                                       
                                                                                </select>
                                       
                                        <input type="button" name="button2" value="Tilf&oslash;j" onClick="makeUrl();" style="font: 8pt verdana;"></td>
                                    </tr>
                                  </table>
                                </td>
                                <td align="left" valign="top">&nbsp;</td>
                              </tr>
                            </table>
                          </td>
                        </tr>
                      </table>
</div>
                  </td>
                </tr>
                <tr valign="top" align="left">
                  <td valign="top">
                    <br>                    <br>
                    <table width="450" border="0">
                      <tr valign="top">
                        <td>
                          <strong><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">                          Overskrift:
                          </font></strong><br>
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr valign="top">
                              <td align="left" bgcolor="#FFFFFF"><input name="Overskrift" type="text" id="Overskrift" value="" size="76">
                                <br>
                              </td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                      <tr valign="top">
                        <td><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><strong>                        Sidetekst:</strong></font>                          <br>
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr valign="top">
                              <td height="265" align="left" bgcolor="#FFFFFF">
                              <iframe id=myEditor src="pd_edit.htm" onFocus="initToolBar(this)" width="480" height=100%></iframe>
                              </td>
                            </tr>
                        </table></td>
                      </tr>
                      <tr valign="top">
                        <td>
                        <br>
                        <input name="Opdater" type="button" value="Opdater" onClick="OnFormSubmit()" style="font: 8pt verdana;">
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="btnSwapView" type="button" value="HTML / Editor - visning" onClick="SwapView_OnClick()" style="font: 8pt verdana;">
                        <img class='clsCursor' name="btnSwapView" src="editor_images/kode.gif" width="0" height="0" border="0" alt="Vis HTML-kode"  onClick="SwapView_OnClick()" align="absmiddle"></td>
                      </tr>
                    </table>
                  </td>
                </tr>
  </table>
<script>
  initToolBar("foo");
  window.status  = "NeoCon.Admin: Editor";
</script>
</form>
</body>
</html>
Avatar billede freud Nybegynder
18. september 2004 - 21:20 #5
lukker spg. da ingen har kunne hjælpe
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