Saturday, 30 August 2014

Show javascript alert box italic, bold, underline etc


<!DOCTYPE html>
<html>
<body>

<script>

var txt = "Hello World!";

document.write("The original string: " + txt);

document.write("<p>Big: " + txt.big() + "</p>");
document.write("<p>Small: " + txt.small() + "</p>");

document.write("<p>Bold: " + txt.bold() + "</p>");
document.write("<p>Italic: " + txt.italics() + "</p>");

document.write("<p>Fixed: " + txt.fixed() + "</p>");
document.write("<p>Strike: " + txt.strike() + "</p>");

document.write("<p>Fontcolor: " + txt.fontcolor("green") + "</p>");
document.write("<p>Fontsize: " + txt.fontsize(6) + "</p>");

document.write("<p>Subscript: " + txt.sub() + "</p>");
document.write("<p>Superscript: " + txt.sup() + "</p>");

document.write("<p>Link: " + txt.link("http://www.w3schools.com") + "</p>");

document.write("<p>Blink: " + txt.blink() + " (does not work in IE, Chrome, Firefox or Safari)</p>");

</script>

</body>
</html>

Result

The original string: Hello World!
Big: Hello World!
Small: Hello World!
Bold: Hello World!
Italic: Hello World!
Fixed: Hello World!
Strike: Hello World!
Fontcolor: Hello World!
Fontsize: Hello World!
Subscript: Hello World!
Superscript: Hello World!
Link: Hello World!
Blink: Hello World! (does not work in IE, Chrome, Firefox or Safari)


Refferenc-
http://www.w3schools.com/jsref/jsref_italics.asp

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...