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


Style issue

Posted on 2003-02-22
Medium Priority
Last Modified: 2010-04-09
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??

Question by:Alk
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
  • Learn & ask questions
  • 2

Expert Comment

ID: 7998379
I dont get it do you mean.

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)

Accepted Solution

Indurain earned 140 total points
ID: 8000099

You can use the <sup> tag

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

Hope this helps.


Expert Comment

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


(should have got points for effort tho, hehe)

Author Comment

ID: 8002496
Sorry for the confusion!!

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question