JavaScript - string HTML wrappers

revision:


String HTML wrappers

list of each method which returns a copy of the string wrapped inside the appropriate HTML tag.

anchor("name") : creates an HTML anchor that is used as a hypertext target. The anchor() method is deprecated in JavaScript. Use the a tag instead.

big() : creates a string to be displayed in a big font as if it were in a <big> tag. he big() method is deprecated in JavaScript. Use the big tag instead.

blink() : creates a string to blink as if it were in a <blink> tag. The blink() method is deprecated in JavaScript. It does not work in any browser.

bold() : creates a string to be displayed as bold as if it were in a <b> tag.The bold() method is deprecated in JavaScript. Use the b tag instead

fixed() : causes a string to be displayed in fixed-pitch font as if it were in a <tt> tag. The fixed() method is deprecated in JavaScript. Use the kbd tag instead.

fontcolor() : causes a string to be displayed in the specified color as if it were in a <font color="color"> tag. The fontcolor() method is deprecated in JavaScript. Use a style attribute instead.

fontsize() : causes a string to be displayed in the specified font size as if it were in a <font size="size"> tag. The fontsize() method is deprecated in JavaScript. Use a style attribute instead.

italics : causes a string to be italic, as if it were in an <i> tag. The italics() method is deprecated in JavaScript. Use the i tag instead.

link() : creates an HTML hypertext link that requests another URL. The link() method is deprecated in JavaScript. Use the i tag instead.

small() : causes a string to be displayed in a small font, as if it were in a <small> tag. The small() method is deprecated in JavaScript. Use an a tag instead.

strike() : causes a string to be displayed as struck-out text, as if it were in a <strike> tag. The strike() method is deprecated in JavaScript. Use the del tag instead.

sub() : causes a string to be displayed as a subscript, as if it were in a <sub> tag. The sub() method is deprecated in JavaScript. Use the sub tag instead.

sup() : causes a string to be displayed as a superscript, as if it were in a <sup> tag. The sup() method is deprecated in JavaScript. Use the sup tag instead.


P.S. HTML wrapper methods return a string wrapped inside an HTML tag. These are not standard methods, and may not work as expected.


examples:

string.anchor() :

string.big() :

string.blink():

string.bold() :

string.fixed():

string.fontcolor() :

string.fontsize() :

string.italics() :

string.link() :

string.small() :

string.strike() :

string.sub() :

string.sup() :

code:
                <div>
                    <p class="spec">string.anchor() : <span id="wrapper1"></span></p>
                    <p class="spec">string.big() : <span id="wrapper2"></span></p>
                    <p class="spec">string.blink(): <span id="wrapper3"></span></p>
                    <p class="spec">string.bold() : <span id="wrapper4"></span></p>
                    <p class="spec">string.fixed(): <span id="wrapper5"></span></p>
                    <p class="spec">string.fontcolor() : <span id="wrapper6"></span></p>
                    <p class="spec">string.fontsize() : <span id="wrapper7"></span></p>
                    <p class="spec">string.italics() : <span id="wrapper8"></span></p>
                    <p class="spec">string.link() : <span id="wrapper9"></span></p>
                    <p class="spec">string.small() : <span id="wrapper10"></span></p>
                    <p class="spec">string.strike() : <span id="wrapper11"></span></p>
                    <p class="spec">string.sub() : <span id="wrapper12"></span></p>
                    <p class="spec">string.sup() : <span id="wrapper13"></span></p>
                    
        
                </div>
                <script>
                    let text = "Hello World!";
                    let result = text.anchor("Chapter 10");
                    document.getElementById("wrapper1").innerHTML = result;
                    
                    let result1 = text.big();
                    document.getElementById("wrapper2").innerHTML = result1;
        
                    let result2 = text.blink();
                    document.getElementById("wrapper3").innerHTML = result2;
        
                    let result3 = text.bold();
                    document.getElementById("wrapper4").innerHTML = result3;
        
                    let result4 = text.fixed();
                    document.getElementById("wrapper5").innerHTML = result4;
        
                    let result5 = text.fontcolor("green");
                    document.getElementById("wrapper6").innerHTML = result5;
                    
                    let result6 = text.fontsize(6);
                    document.getElementById("wrapper7").innerHTML = result6;
        
                    let result7 = text.italics();
                    document.getElementById("wrapper8").innerHTML = result7;
        
                    let result8 = text.link("https://www.lwitters.com");
                    document.getElementById("wrapper9").innerHTML = result8;
        
                    let result9 = text.small();
                    document.getElementById("wrapper10").innerHTML = result9;
        
                    let result10 = text.strike();
                    document.getElementById("wrapper11").innerHTML = text + " " + result10;
        
                    let result11 = text.sub();
                    document.getElementById("wrapper12").innerHTML = text + " " + result11;
        
                    let result12 = text.sup();
                    document.getElementById("wrapper13").innerHTML = text + " " + result12;
        
                </script>