Forums / Setup & design / javascript needs text field on one line

javascript needs text field on one line

Author Message

Felix Laate

Friday 08 April 2005 6:53:09 am

Hi all!

I'm fetching som text from a class and I want it to be the string of a variable in a javascript function.

Only problem is that javascript wants the string to be on one line.

Is there a operator that can achieve this? Or is there another way?

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Łukasz Serwatka

Monday 11 April 2005 6:08:26 am

Hi Felix,

Could you paste your code example here?

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Felix Laate

Monday 11 April 2005 6:14:33 am

Hi Luke!

As I found no answer to this question, I decided to first put the content into seperate spans, and then switch the content of the div with that of the desired span. This works great, but gives me a set with extra spans (which are hidden of course).

Anyways: the code of my original plan is this:

<script type="text/javascript">
<!--
// Endre tekst på branner
var allFires= new Array(2000);

{section name=Fire loop=$branner}					
{*$Fire:item.data_map|attribute(show)*}

allFires[{$Fire:item.data_map.year.content}] = "<strong>{$Fire:item.data_map.title.content}</strong><p>{$Fire:item.data_map.description.data_text|break}</p>";
{/section}
{literal}

function changeText(year) {
  document.all.branntekst.innerHTML = allFires[year];
}

{/literal}
//-->
</script>

Would be great if it was doable!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com