PDA

View Full Version : Font Chooser window



rahulrborkar
05-15-2008, 09:51 AM
Hi Folks,:)

I want a Font chooser pop up window which should be displayed when we click on particular HTML button and return me chosen font with all parameters.

Can anybody here please provide me a link where Can I get this?

Thanks & Regards,
Rahul. :rolleyes:

rangana
05-15-2008, 10:08 AM
You might find this code useful :)


<input type="button" value="Run Script" onclick="rangFunc()">
<div id="wrap">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin massa. Nam vehicula.
Morbi velit nisi, mollis id, ultrices luctus, adipiscing sit amet, lectus. Nunc rhoncus
nisl ac enim. Maecenas vestibulum dolor ut velit. Maecenas condimentum pulvinar purus.
Pellentesque ac ipsum. Curabitur sodales, elit vel molestie hendrerit, elit odio rhoncus tellus,
</div>
<script type="text/javascript">
function rangFunc()
{
var color=prompt('What is your desired font color','black');
var size=prompt('What is your desired font size (pt)','12');
var type=prompt('What is your desired font family','Tahoma');
var style=prompt('How about your font style (Italic, Bold, Normal)','Normal');
var wrap=document.getElementById('wrap');
wrap.style.color=color;
wrap.style.fontSize=size+'pt';
wrap.style.fontFamily=type;
if(style.toLowerCase()=='italic')
wrap.style.fontStyle='italic';
if(style.toLowerCase()=='normal')
wrap.style.fontWeight='normal';
if(style.toLowerCase()=='bold')
wrap.style.fontWeight='bold';
}
</script>

rahulrborkar
05-15-2008, 01:28 PM
Hi Rangana
Thanks a lot...

Really thats help, but can you also provide site link where I can find such scripts ?
also I want to show some good UI window on click of button where I can choose font and color at the same time will be able to watch preview for it.
I'm going to start with this but any help in this will be really helpful.

Again thanks a lot.

Reagrds,
Rahul

rangana
05-15-2008, 11:59 PM
Hi Rangana
Thanks a lot...

Really thats help, but can you also provide site link where I can find such scripts ?

Again thanks a lot.

Reagrds,
Rahul

That code came fresh from my mind basing on your requirement ;)

You might find this link useful ;)
http://www.ahfb2000.com/colors.html