How can I insert html code inside a javascript value?
What a way to add this HTML code inside Java Flo
For example: This :
https://jsfiddle.net/asfarmohamed/3oukv31s/
Inside this script :
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
UPDATE:-
I understood what you were looking for. Run this HTML and you will get it.
<html>
<body
<div id = "htmls"></div>
<script>
var b = "<input type='button' value ='click'> ";
document.getElementById("htmls").innerText = b;
</script>
</body>
</html>
Suppose you have a variable that contains the HTML codes for a button.
var b = "<input type='button' value='click'>"
Now you can do stuffs like this-
document.write(b);
This will show you a html page having the HTML codes of variable b. Keep in mind that, you should follow the quotes rule. Here the value of variable b is written inside two double quotes. Notice carefully that when
type = 'button'
is written, single quotes were used. Hope you get it
只需像通常一样添加
widget.value += "<div> this is html </div>";
链接地址: http://www.djcxy.com/p/46032.html
