Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

Style issue

Posted on 2003-02-22
Medium Priority
148 Views
I want to write x to be squared, ie x2 but the 2 is to the power of x.
how do i get the 2 like that??

0
Question by:Alk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

Expert Comment

ID: 7998379
I dont get it do you mean.

<script>
var x = 2;
document.write("square of x: " + parseFloat((x * x)))

var y = Math.pow(x, 2);
document.write("y = xpower of 2: " + y)

//i think you might want this
var pow = 3; //power of newx
var newx = 5;

var curnum = newx;
for (var i=0;i<(pow+1);i++){
curnum = curnum * curnum;
}
document.write(newx + " to the power of " + pow + " is " + curnum)
</script>
0

Accepted Solution

Indurain earned 140 total points
ID: 8000099
Alk,

You can use the <sup> tag

e.g., x<sup>2</sup>  should produce the desired result.

Hope this helps.

0

Expert Comment

ID: 8000454
lol, thats what he ****ing meant.

sorry,
!!!
RB

(should have got points for effort tho, hehe)
0

Author Comment

ID: 8002496
Excellent
Sorry for the confusion!!
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Suggested Courses
Course of the Month9 days, 17 hours left to enroll