我怎样才能插入一个JavaScript值内的HTML代码?

在Java Flo中添加此HTML代码的一种方法

例如:这:

https://jsfiddle.net/asfarmohamed/3oukv31s/

在这个脚本里面:

widget.value += ""; 

    
    Pro Roseic Facebook POP-UP Box by Widget Generators
    
    
    
    ;
    function RWGcodegen(){
    var RWGfb = document.getElementsByName("fb")[0].value
    var widget=document.getElementsByName("widget.content")[0];

    widget.value += "  "; 
    widget.value += "  "; 
    widget.value += "  "; 
    widget.value += " function r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()}; r(function(){new ConversionsBox("Like%20Us%20On%20Facebook","http://www.facebook.com/"+ RWGfb +"");}); "; 
    widget.value += "  "; 
    widget.value += "  "; 

    document.getElementsByName("go")[0].disabled = false;
              document.getElementsByName("preview")[0].disabled = false;
            }

    function RWGpredemo(){
    var demodata = document.getElementsByName('RWGjs')[0].value + document.getElementsByName('widget.content')[0].value;
    newwindow = window.open('', 'name', '');
    var tmp = newwindow.document;
    tmp.write('' + demodata + '');
    tmp.close();
    }

    function RWGReset(){
    var widget=document.getElementsByName("fb")[0].value="hooter-spot"
    var widget=document.getElementsByName("widget.content")[0].value=""
    }
    

          
    body{background:#000 url(http://www.3dwallpaper.org/walls/digital_matrix_neon_background-wide.jpg) repeat;
    }/*atau no-repeat fixed center, no-repeat center, dll (sesuaikan dengan size gambar)*/
    
    
    
    Facebook POP-UP Box Generator  

    

    
    .input-text,.text-input, .select-box{
     margin:0 2px;
     padding:4px 6px;
     border: 1px solid #434343;
     -webkit-border-radius: 4px;
     -moz-border-radius: 4px;
     border-radius: 4px;
     font-family: gergia;
     font-style: italic;
     -webkit-box-shadow: 4px 4px 4px #434343;
     -moz-box-shadow: 4px 4px 4px #434343;
     box-shadow: 4px 4px 4px #434343;
     font-size: 14px;
     color: #666;
     max-width:auto;
    }
    .textarea-box, .textareaBox{
     border:2px dotted #7C7B7B;
     padding:6px;
     -webkit-resize: none;
     -moz-resize: none;
     resize: none;
     -webkit-box-shadow: 4px 4px 4px #434343;
     -moz-box-shadow: 4px 4px 4px #434343;
     box-shadow: 4px 4px 4px #434343;
     -webkit-border-radius: 8px;
     -moz-border-radius: 8px;
     border-radius: 8px;
    }


    .redius{
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px; }
    }
    #RWGgadform {
        font-family: Georgia, serif;
    }

    #RWGgadmn fieldset {
        border: 2px dotted #000000;
        background: #ffffff;
        padding: 0 20px;
    }

    #RWGgadmn legend {
        background-color:#434343;
        background: -moz-linear-gradient(center top , #000000 0%, #434343 100%) repeat scroll 0 0 transparent;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0090f7), color-stop(100%,#1f5ea2));
    background: -webkit-linear-gradient(top, #0090f7 0%,#1f5ea2 100%);
    background: -o-linear-gradient(top, #0090f7 0%,#1f5ea2 100%);
    background: -ms-linear-gradient(top, #0090f7 0%,#1f5ea2 100%);
    background: linear-gradient(top, #0090f7 0%,#1f5ea2 100%);
        border: 2px solid;
        border-radius: 14px 14px 14px 14px;
        color: #FFFFFF;
        font: 21px arial,Sans MS;
        padding: 4px;
        text-align: center;
        text-shadow: 1px 1px 1px #000000;
    }


    #RWGgad fieldset {
        border: 2px solid #000000;
        background: #FFFFFF;
        padding: 0 20px;
    }
    #RWGgad legend {
    background-color:#434343;
        background: -moz-linear-gradient(center top , #000000 0%, #434343 100%) repeat scroll 0 0 transparent;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0090f7), color-stop(100%,#1f5ea2));
    background: -webkit-linear-gradient(top, #0090f7 0%,#1f5ea2 100%);
    background: -o-linear-gradient(top, #0090f7 0%,#1f5ea2 100%);
    background: -ms-linear-gradient(top, #0090f7 0%,#1f5ea2 100%);
    background: linear-gradient(top, #0090f7 0%,#1f5ea2 100%);
        border: 2px solid;
        border-radius: 14px 14px 14px 14px;
        color: #FFFFFF;
        font: 17px arial,Sans MS;
        padding: 4px;
        text-align: center;
        text-shadow: 1px 1px 1px #ffffff;
    }

    .RWGbtn {
        background: -moz-linear-gradient(center top , #F4F4F4 0%, #D8E1E7 100%) repeat scroll 0 0 transparent;
        background-color:#F4F4F4;
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f4f4f4), color-stop(100%,#d8e1e7));
    background: -webkit-linear-gradient(top, #f4f4f4 0%,#d8e1e7 100%);
    background: -o-linear-gradient(top, #f4f4f4 0%,#d8e1e7 100%);
    background: -ms-linear-gradient(top, #f4f4f4 0%,#d8e1e7 100%);
    background: linear-gradient(top, #f4f4f4 0%,#d8e1e7 100%);
        border: 1px solid #A8B5BF;
        border-radius: 3px 3px 3px 3px;
        cursor: pointer;
        padding: 4px 14px;
    }

    .RWgbtn:hover {
        background: none repeat scroll 0 0 #D8E1E7;
    }

    

    
    
    Customize
    
    
    FaceBook Page ID
    : 
    




    
    
    
    
Application / Buttons
Generated Code



| hooter-spot

更新: -

我明白你在找什么。 运行这个HTML,你会得到它。

<html>
<body

<div id = "htmls"></div>

<script>
    var b = "<input type='button' value ='click'>  ";
    document.getElementById("htmls").innerText = b;
</script>


</body>
</html>

假设您有一个包含按钮HTML代码的变量。

var b = "<input type='button' value='click'>"

现在你可以做这样的东西 -

document.write(b);

这会显示一个HTML页面,其HTML代码为变量b。 请记住,你应该遵循报价规则。 这里变量b的值写在两个双引号内。 小心通知,何时

type = 'button'

被写入,单引号被使用。 希望你得到它


只需像通常一样添加

widget.value += "<div> this is html </div>";
链接地址: http://www.djcxy.com/p/46031.html

上一篇: How can I insert html code inside a javascript value?

下一篇: How to clear setInterval function?