HighDots Forums  

Help - Space in script that splits at comma

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Help - Space in script that splits at comma in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Hoggman
 
Posts: n/a

Default Help - Space in script that splits at comma - 08-16-2004 , 07:25 PM






Hi all

take a look at http://www.beal-homes.com/test.asp

I have used the script below to split a field down at commas and then
created a new string

This works but after the first item there is a space where the comma used to
be, is there any way I can remove this?

Thanks

Matt Houldsworth



<script language="javascript">
var devText="<%=(houses.Fields.Item("location").Value) %>";

function getDevelopments() {
var input = devText.split(",");
var input2 = new String();
for (var i = 0; i<input.length; i++) {
input2 += "<a
href='home_template.asp?id=<%=(houses.Fields.Item( 'id').Value)%>&titleofdeve
lopment=" + input[i] + "'>" + input[i] + "</a>" +"<br>";
} document.all("dev").innerHTML = input2;
}
</script>








Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.