PDA

View Full Version : Sizing problem with Drop Down Menu w/ description



Chevalrose
01-08-2009, 09:04 PM
1) Script Title:
Drop down menu w/ description

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex1/combodescribe.htm

3) Describe problem:

I can't seem to get the text descriptions to be more than one line. What do I have to add/change for this?

ddadmin
01-09-2009, 02:38 AM
Are you asking how to insert a line break somewhere in the text description?

Nile
01-09-2009, 02:42 AM
I would assume you would do something like this(works for me...):


var thetext1=new Array()
thetext1[0]="Comprehensive JavaScript<br />tutorials and over 400+ free scripts"
thetext1[1]="Direct link to hundreds of free Java applets online!"
thetext1[2]="Up to date news on the technology front"
thetext1[3]="News.com- The #1 technology News site."
thetext1[4]="Web Coding and development forums"

Chevalrose
01-09-2009, 02:52 AM
Oh my gosh that is so simple, I can't believe I didn't think of that. Thanks!

I was thinking of it being a paragraph of words rather than "seperated lines", but whatever lets me add more to it is find by me :-)

Nile
01-09-2009, 02:56 AM
Yeah - sometimes the simplest things in life work. :D I'm glad to help you - and your welcome. :)

Chevalrose
01-09-2009, 03:10 AM
Well I tried it, and it doesn't work for what I need it to. It does break with a small amount of text, but I'd like it to have A LOT of text. This for example:

"...This is the perfect fall fragrance! Spicy, sweet, and complex. Vanilla intertwines with a spice cabinet of cinnamon, clove, allspice, kissed with sugar. Hints of nutmeg and fruits peak out from the heart notes. If you are not a fan of bakery scents, this is nowhere near the typical "bakery" realm, give it a try! Very unique and different. - Best Seller!"

I did try breaking it at small intervals, but the amount of text screws it all up. Is this even possible with this code? If not is there another somone could suggest thats similar?

Nile
01-09-2009, 03:11 AM
Change:


<span id="textcontainer1" align="left" style="font:italic 13px Arial">

To:


<span id="textcontainer1" align="left" style="font:italic 13px Arial;width: 300px;">

Chevalrose
01-09-2009, 03:14 AM
You know I tried that originally, but thinking back...I think I forgot the stupid semi-colon. :rolleyes:

Thank you again, I'll try it :-)

Nile
01-09-2009, 03:14 AM
Hah - ok, tell me what you get. If that doesn't work, change the span to a div.
Change the <span> to a <div> and apply the style - that will work. Tested. :)

Chevalrose
01-09-2009, 03:27 AM
So I've tried width and I've tried height and while that does expand the area below the box...the text just wont show up! There are " in the front and back of the whole text, just like the others. It works this way when it's the original sentence...so I don't know what the large amount of text is messing it up.

I tried <div> and <span> and nothing. Heres what I got (drastic height/width to see what was working :) ):




<form name="form1">
<select name="select1" size="1" style="background-color:#FFFFD7" onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')">
<option selected value="http://www.javascriptkit.com">JavaScript Kit </option>
<option value="http://freewarejava.com">Freewarejava.com</option>
<option value="http://wired.com" target="newwin">Wired News</option>
<option value="http://www.news.com">News.com</option>
<option value="http://www.codingforums.com" target="newwin">Coding Forums</option>
</select>
<input type="button" value="Go"
onClick="jumptolink(document.form1.select1)"><br>
<div id="textcontainer1" align="left" style="font:italic 13px Arial; width:500px; height: 600px">
</div>
</form>




//1) CUSTOMIZE TEXT DESCRIPTIONS FOR LINKS ABOVE
var thetext1=new Array()
thetext1[0]="This is the perfect fall fragrance! Spicy, sweet, and complex. Vanilla intertwines with a spice
cabinet of cinnamon, clove, allspice, kissed with sugar. Hints of nutmeg and fruits peak out from the heart
notes. If you are not a fan of bakery scents, this is nowhere near the typical "bakery" realm, give it a try! Very
unique and different. - Best Seller!"
thetext1[1]="Direct link to hundreds of free Java applets online!"
thetext1[2]="Up to date news on the technology front"
thetext1[3]="News.com- The #1 technology News site."
thetext1[4]="Web Coding and development forums"

Nile
01-09-2009, 03:31 AM
Replace your highlighted array in the script to:


thetext1[0]="This is the perfect fall fragrance! Spicy, sweet, and complex. Vanilla intertwines with a spice cabinet of cinnamon, clove, allspice, kissed with sugar. Hints of nutmeg and fruits peak out from the heart notes. If you are not a fan of bakery scents, this is nowhere near the typical \"bakery\" realm, give it a try! Very unique and different. - Best Seller!"

Remember to strip slashes.

Chevalrose
01-09-2009, 03:32 AM
Ok...so get this...It works when I type it out myself, but doesn't when I copy paste.

Unbelievable. Thanks for all the help Niles! I have a lot of typing ahead of me :)


Ahh...stupid quotes I didn't even notice them! Again...thanks :D

Nile
01-09-2009, 03:34 AM
Maybe your including something in your copy and paste such as an invalid character. I'm glad to help you. And remember, strings should always be slashes:


var string1 = "How are you doing? I'm "very" good :D";
var string2 = "How are you doing? I'm doing \"Very\" good :D";

Try this to do it for you(remember when you start and end the string, that should not be stripped):
http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_addslashes/