Hi.
Sorry for my bad English level.
I have a select like this:
<select class="required-entry super-attribute-select"
id="attribute525" name="super_attribute[525]">
<option value="">Choose an Option...</option>
<option value="100">Small</option>
<option value="99">Medium</option>
<option value="98">Large</option>
</select>
and one script that execute some functions when someone change the
value of the select:
Product.Config = Class.create();
Product.Config.prototype = {
initialize: function(config){
this.config = config;
this.taxConfig = this.config.taxConfig;
this.settings = $$('.super-attribute-select');
this.state = new Hash();
this.priceTemplate = new Template(this.config.template);
this.prices = config.prices;
this.settings.each(function(element){
Event.observe(element, 'change',
this.configure.bind(this))
}.bind(this));
// fill state
this.settings.each(function(element){
var attributeId = element.id.replace(/[a-z]*/, '');
if(attributeId && this.config.attributes[attributeId]) {
element.config = this.config.attributes[attributeId];
element.attributeId = attributeId;
this.state[attributeId] = false;
}
}.bind(this))
// Init settings dropdown
var childSettings = [];
for(var i=this.settings.length-1;i>=0;i--){
var prevSetting = this.settings[i-1] ?
this.settings[i-1] : false;
var nextSetting = this.settings[i+1] ? this.settings[i
+1] : false;
if(i==0){
this.fillSelect(this.settings[i])
}
else {
this.settings[i].disabled=true;
}
$(this.settings[i]).childSettings = childSettings.clone();
$(this.settings[i]).prevSetting = prevSetting;
$(this.settings[i]).nextSetting = nextSetting;
childSettings.push(this.settings[i]);
}
// try retireve options from url
var separatorIndex = window.location.href.indexOf('#');
if (separatorIndex!=-1) {
var paramsStr = window.location.href.substr(separatorIndex
+1);
this.values = paramsStr.toQueryParams();
this.settings.each(function(element){
var attributeId = element.attributeId;
element.value = this.values[attributeId];
this.configureElement(element);
}.bind(this));
}
},
configure: function(event){
var element = Event.element(event);
this.configureElement(element);
},
//more ....
I want put the select into <div class="no-display"> to hide this. and
with javascript to change manually the value of the select and execute
the functions like the mouse.
for example:
$('attribue525').selectedIndex=2;
$('attribue525').change= true
//because I need to execute the event onchange --
>Event.observe(element, 'change', this.configure.bind(this))
anyone knows how to do this?
Thanks.
Bye
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.