I want to display multiple polylines with different colors in openlayers. Can any one guide me regarding this.
I have done this in google maps. but i don't know how to do it in openlayers. I am newbie to Openlayers.

I want to display multiple polylines with different colors in openlayers. Can any one guide me regarding this.
I have done this in google maps. but i don't know how to do it in openlayers. I am newbie to Openlayers.

Every feature has a style property which is null by default because it inherits the parent vector layer's style. But you can set the style for each feature:

Code Example:
var myFirstLineStyle = OpenLayers.Util.applyDefaults(myFirstLineStyle, OpenLayers.Feature.Vector.style['default']);
myFirstLineStyle.strokeColor = "#ffffff";
myFirstLineStyle.strokeWidth = 8;
firstFeature.style = myFirstLineStyle;
var mySecondLineStyle = OpenLayers.Util.applyDefaults(mySecondLineStyle, OpenLayers.Feature.Vector.style['default']);
mySecondLineStyle.strokeColor = "#000000";
mySecondLineStyle.strokeWidth = 4;
secondFeature.style = mySecondLineStyle;
If you change the styles of the features after they've been added to the layer you must call layer.redraw().
Wow,
Instead of all this, u can configure your style with attribute replacement](http://docs.openlayers.org/library/feature_styling.html#attribute-replacement-syntax).
Then when a new feature is draw you have to intercept the featureAdded event and set the field to use in the replacement.