UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Line Breaks With Script Type: Text/javascript    
 
   
nols76
post Apr 16 2014, 09:50 AM
Post#1



Posts: 49
Joined: 14-June 12



Hi all. Im new to Java and have a simple question that Im struggling with. In this form the user selects, lets say, Option Value 1 and the help text returns:
Smaller Impact, Less Complexity, Smaller Scope, Shorter Time To Deliver. Recipient of Client/Partner Commendation. Displays Exceptional Partnership and/or Teamwork
However I Wish to break out each sentence into it's own line:
Smaller Impact, Less Complexity, Smaller Scope, Shorter Time To Deliver.
Recipient of Client/Partner Commendation.
Displays Exceptional Partnership and/or Teamwork

How do I do this?
THere is the code im looking at. Many thanks.
CODE
<script type="text/javascript">
var textBlocks = new Array(
' ',
"Smaller Impact, Less Complexity, Smaller Scope, Shorter Time To Deliver. Recipient of Client/Partner Commendation.  Displays Exceptional Partnership and/or Teamwork",
'Text block two',
'Text block three');
function changeText(elemid) {
var ind = document.getElementById(elemid).selectedIndex;
document.getElementById("display").innerHTML=textBlocks[ind];
}
</script>
</head>
<body>
<form>
    <select id="whatever" onchange="changeText('whatever');">
    <option value="0">Select</option>
    <option value="1">Delivers First Class Business in a First Class Way
    </option>
    <option value="2">Improves Controls</option>
    <option value="2">Improves Bottom Line</option>
    <option value="2">Drives Business Growth and/or Champions Innovation
    </option>
    </select><br>
</form>
<table style="width: 100%">
    <tr>
        <td colspan="2">
        <div id="display" style="width: 468px" class="style1">
            Select from the list to change this box</div>
        </td>
        <td>&nbsp;</td>
    </tr>
Go to the top of the page
 
datAdrenaline
post Apr 16 2014, 12:22 PM
Post#2


UtterAccess Editor
Posts: 17,941
Joined: 4-December 03
From: Northern Virginia, USA


I would think putting the <br> tag where you want to break the line would do the trick.
Go to the top of the page
 
nols76
post Apr 16 2014, 12:27 PM
Post#3



Posts: 49
Joined: 14-June 12



Thanks for the reply. However I've been trying that and it seems to break when I test it out:(
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th December 2017 - 01:16 AM