Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a font w/ two or more attributes in JavaScript

Status
Not open for further replies.

mmt4331

Programmer
Dec 18, 2000
125
0
0
US

Please look at the script below, and after you do, I have a question to ask:


//Input Box & Format Text

var InputBox = prompt("What is your name?","Name Input Box");
var Response = ("Thank you for entering your name, " + InputBox);

var ColorResponse = Response.fontcolor('red');
var FontUpperCase = Response.toUpperCase();
var FontColletor = FontUpperCase;

// Output

document.writeln(FontColletor);

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
My question is this:
How do I get the data inside the variable FontCollector to become both uppercase and the color red? Right now, obviously, I'm getting my font to be just uppercase. Thx.

Mark
 
<html>
<script>

function load()
{
var name = prompt(&quot;What is your name?&quot;,&quot;&quot;);
var txt = document.createTextNode((name ? &quot;thank you for entering your name &quot; + name : &quot;Please enter a name in the box&quot;))
var span = document.createElement(&quot;span&quot;)
span.style.color = &quot;Red&quot;
span.style.fontWeight = &quot;bold&quot;

span.appendChild(txt)
document.body.appendChild(span)
}

</script>
<body onload=&quot;load()&quot;>


</body>
</html>

Gary Haran
==========================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top