Jump to content

Javascript at single page


Recommended Posts

Hi.

 

Im new to Prestashop.

 

I have created a page in "CMS" in the admin, and made a html form in the html editor. Now i want to insert the following Javascript:

 

<script type="text/javascript">
//<![CDATA[
// array of possible countries in the same order as they appear in the country selection list
var boldLists = new Array(4)
boldLists["empty"] = ["Vælg Producent"];
boldLists["Titleist"] = ["Pro V1", "Pro V1x", "NXT Tour", "NXT Tour S", "Velocity", "DT SoLo", "DT SoLo Yellow"];
boldLists["Callaway"] = ["Warbird Plus", "Diablo Tour", "Solaire", "Diablo", "HEX Chrome", "HEX Black"];
boldLists["Wilson Staff"] = ["FG Tour", "FG Tour X", "DX3 Soft Spin", "DX2 Soft Yellow", "DX2 Soft", "DX2 W", "Ti-DNA"];
boldLists["Srixon"]= ["Soft Feel", "AD 333", "Trispeed", "Z-star"];
boldLists["Pinnacle"] = ["Gold", "Gold Lady", "Gold Lady, Pink", "Gold, Gul"];
boldLists["Taylormade"] = ["Burner", "Rocket Ballz", "Penta", "TP3"];
boldLists["Nike"] = ["Power Distance Soft", "Power Distance Long", "Power Distance Women", "Crusch", "Golf Vapor Black", "20XI-s", "20XI-x"];
boldLists["Bridgestone"]= ["E5", "E6", "E7", "B 330 RXS", "Tour B330S", "B 330 Tour", "B330RX Tour"];
/* CountryChange() is called from the onchange event of a select element.
* param selectObj - the select object which fired the on change event.
*/
function boldChange(selectObj) {
// get the index of the selected option
var idx = selectObj.selectedIndex;
// get the value of the selected option
var which = selectObj.options[idx].value;
// use the selected option value to retrieve the list of items from the countryLists array
cList = boldLists[which];
// get the country select element via its known id
var cSelect = document.getElementById("page3select");
// remove the current options from the country select
var len=cSelect.options.length;
while (cSelect.options.length > 0) {
cSelect.remove(0);
}
var newOption;
// create new options
for (var i=0; i<cList.length; i++) {
newOption = document.createElement("option");
newOption.value = cList[i];  // assumes option string and value are the same
newOption.text=cList[i];
// add the new option
try {
cSelect.add(newOption);  // this will fail in DOM browsers but is needed for IE
}
catch (e) {
cSelect.appendChild(newOption);
}
}
}
//]]>
</script>

 

How to do that?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...