Click to See Complete Forum and Search --> : Option list helllllppppppp!


Code One
03-19-2003, 07:29 PM
I can not figure out how to link this go button to my list so that when I select a font name in the list and click go the font within the textarea will change and its size, any help?

code:
<script language="JavaScript1.2" type="text/javascript">

function ChangeFontFamily(id, family) {
document.getElementById(id).style.fontFamily = family;
}
function ChangeFontSize(id, size) {
document.getElementById(id).style.fontSize = size + "px";
}

</script>
</head>
<body>
<center><form>
<textarea width=200 height=200 id="lyr"></textarea><div>
<select name="list">
<option onclick="ChangeFontFamily('lyr','Times New Roman');ChangeFontSize('lyr','12')">Time
&nbsp;
<option onclick="ChangeFontFamily('lyr','Arial');ChangeFontSize('lyr','12')">Arial
&nbsp;
<option onclick="ChangeFontFamily('lyr','Jokerman');ChangeFontSize('lyr','12')">Jokerman
&nbsp;
</select>
<INPUT TYPE=BUTTON VALUE="GO"> (link this with TA above)

</form>



any help would be great!!!
thanks in advance

Code One

khalidali63
03-19-2003, 09:14 PM
Check this out..


<script type="text/javascript">
function Process(){
var listBox = document.form1.lb;
var index = listBox.selectedIndex;
var family = listBox.options[index].value;
var size = listBox.options[index].size;
document.getElementById("lyr").style.fontFamily = family;
document.getElementById("lyr").style.fontSize = size + "px";
}
</script>
</head>
<body>
<form name="form1" action="">
<textarea width=200 height=200 id="lyr"></textarea>
<select name="lb">
<option value="Times New Roman" size=12 />Time
<option value="sans-serif" size=16 />Sans Serif
<option value="cursive" size=14 />Jokerman
</select>
<input type="Button" value="GO" onclick="Process();"> (link this with TA above)
</form>


Cheers

Khalid

Code One
03-19-2003, 09:59 PM
That did it Khalid!!! Once again your the man!!!

Code One

edit: Oh yeah, thanks!

Code One
03-19-2003, 10:50 PM
Do you know how to keep the textarea from resizing when the font changes? I saw it some were one time but I cant find it now . . . big thanks for all the help bro!

Code One

khalidali63
03-19-2003, 11:16 PM
ad this attribute in the textarea element

style="width:200pt;height:200pt;"

set the width and height properties to as you wish

Cheers

Khalid

Code One
03-19-2003, 11:35 PM
Is there anything about programming that you dont know how to do? You defenently rock!!!!
Hey man I am a good developer, but I am a much better music producer. If you ever need any tracks, for any of your programs or web pages, let me know . . . I'll hook you up free of charge. I work with almost every audio mixing, producing, and mastering program you can buy, I have Nuendo, Cubase, Emagic, Acid Pro, Acid Architect, Cake walk home studio, and about every plug in available. So trust me when I say I can hook you up. I can produce ANY style you want and my fortay is classical. So you just let me know what you want and I'll have it on your desk in no time!!!!! Cool?
Peace buddy

Get in contact: Kingx@insightbb.com

Note:* Anyone else interested in this offer, will be charged. Trades are welcome. Just leave your offers in your email requests and I will get back to you ASAP. Do not forget to leave a description of what you want and what for.

Thanks

Code One

Jona
03-19-2003, 11:37 PM
You mean you produce music? What kinds?

Code One
03-19-2003, 11:45 PM
Typically I compose classical, but I have been known to compose very killer nu-metal tracks, some hip-hop, trip-hop, techno, mood . . . the list is infinite. Like I said above I am capable of composing ANY style of music. If you are wanting to obtain tracks for yourself, I would love to work out something with you. I dont charge heavily, because I typically work with developers. They typically request short tracks which take me just a few hours. If you are wanting to make a request I suggest you do it in an email outside of this server, due to solicitng reasons.

Thanks

Code One

Code One
03-20-2003, 02:28 AM
anyone know how to associate this menu to this function, ive tried and tried looked and looked, referenced and you know the rest . . .

code:
<style>
#menu{
position:absolute;
width:125px;
border:2px solid black;
background-color:menu;
font-family:Verdana;
line-height:20px;
cursor:default;
visibility:hidden;
}
.menuitems{
padding-left:15px;
padding-right:15px;
}
</style>

<script language="JavaScript1.2">
//set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
var display_url=1
function showmenu(){
var rightedge=document.body.clientWidth-event.clientX
var bottomedge=document.body.clientHeight-event.clientY

if (rightedge<menu.offsetWidth)
menu.style.left=document.body.scrollLeft+event.clientX-menu.offsetWidth
else
menu.style.left=document.body.scrollLeft+event.clientX

if (bottomedge<menu.offsetHeight)
menu.style.top=document.body.scrollTop+event.clientY-menu.offsetHeight
else
menu.style.top=document.body.scrollTop+event.clientY

menu.style.visibility="visible"
return false
}

function hidemenu(){
menu.style.visibility="hidden"
}

function over(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor="highlight"
event.srcElement.style.color="white"
if (display_url==1)
window.status=event.srcElement.url
}
}

function out(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor=""
event.srcElement.style.color="black"
window.status=''
}
}

function Process(){ <-(theres the dang script to link to)
var listBox = document.form1.menuitems;
var index = listBox.selectedIndex;
var family = listBox.options[index].value;
var size = listBox.options[index].size;
document.getElementById("lyr").style.fontFamily = family;
document.getElementById("lyr").style.fontSize = size + "px";
}
</script>
<script>
</script>
</head>

<body>
<div id="menu" onMouseover="over()" onMouseout="out()" onClick="Process()">
<div class="menuitems">10pt</div> <-(thers the dang <div> tags to link all)
<div class="menuitems">12pt</div>
<div class="menuitems">14pt</div>
<div class="menuitems">18pt</div>
<div class="menuitems">20pt</div>
</div>
<form name="form1" action="">
<textarea style="width:200pt;height:200pt;" id="lyr"></textarea> <-(theres the dang textarea to associate)
</form>
<script language="JavaScript1.2">
document.oncontextmenu=showmenu
if (document.all&&window.print)
document.body.onclick=hidemenu
</script>


Guys Im totally stumped, any one know how I can link those dang <div> tags to the function Process() script, so I can change the font size in that textarea? I totally appreciate any help.

Code One

Code One
03-20-2003, 03:41 PM
look at my last post, will you see if there is anything you can do, if you dont feel like it, its cool.


Thanks bud

Code One