List Info

Thread: Re: Re: Using SuperScript in textfield




Re: Re: Using SuperScript in textfield
country flaguser name
Sweden
2007-02-25 05:24:43
sunitha semval wrote:
> Hi Jon,
>  
> Ok thanks. Do you have any source code to do this using
div,p or any 
> other element.  Actually the main thing is I even want
it to send to 
> other jsp file the value and read it using
request.getParameter().


I'm not 100% sure about what you're asking.

And please note that I know next to nothing about JSPs.

The basic concept is pretty simple, though - just treat the
number as a 
string, split it using the decimal point as the limiter, and
wrap the 
portion following the decimal in a SUP element. Say you've
got this HTML:

<form name="myForm">
   <input name="myInput"
type="text"/>
</form>

and somebody enters "8.30" into the input.

#  get the value that was entered

var myForm = document.myForm;
var myInput = myForm.myInput;

var myVal = myInput.value;

#  split the value

var parts = myVal.split(".");

#  create new paragraph and new superscript elements:

var newP = document.createElement("p");
var newSup = document.createElement("sup");

#  insert the parts of the text into the appropriate
elements,
#  and the new SUP element into the new P element:

newP.appendChild(parts[0]);
newSup.appendChild(parts[1]);
newP.appendChild(newSup);

# and display it in the page:

myForm.appendChild(newP);

# if you like, hide the original text input:

myForm.myInput.style.display = "none";

This is all purely client-side. There's no change in how you
obtain the 
text input's value and process it server-side.

NB: I prefer if we keep threads that start on the JS list on
the list. 
Then everyone can contribute to and benefit from the
discussion. Thanks!

>  
> Anyways thanks for your reply.
>  
> Regards,
> Sunitha.
> 
> */Jon Stephens <jonhiveminds.net>/* wrote:
> 
> 
>      > Using SuperScript in textfield Posted by:
"sunitha semval"
>      > ss_semvalyahoo.co.in
<mailto:ss_semval%40yahoo.co.in> ss_semval
>     Date: Wed Feb 21, 2007 6:58 am
>      > ((PST))
>      >
>      > Hi,
>      >
>      > I am trying to use superscript in textfield.
Like: I want 8.30 to be
>      > converted to 8 to the power of 30 in the
textfield.
>      >
>      > Is there any way..
>      >
>      > Regards, Sunitha
> 
>     Short answer: No.
> 
>     Longer answer: Input and textarea elements cannot
contain markup, only
>     text. This means you can style all of the content
of an input or
>     textarea, but you cannot style only a portion of it
- it's an all or
>     nothing proposition. You'd need to use a div, p or
other element that
>     can contain HTML markup in order to do this.
> 

-- 
This message has not been scanned for viruses.

Since I do not use a Microsoft operating
system or software, and use only plaintext
for email, there is little need for me to do so.


------------------------ Yahoo! Groups Sponsor
--------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/4It09A/fOaOAA/yQLSAA/edFolB/TM

------------------------------------------------------------
--------~-> 

Visit http://aiaiai.com for
more groups to join 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    ht
tp://groups.yahoo.com/group/JavaScript_Official/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/JavaScript_Official/join

    (Yahoo! ID required)

<*> To change settings via email:
    mailto:JavaScript_Official-digest@yahoogroups.com 
    mailto:JavaScript_Official-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    JavaScript_Official-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )