lilpete
09-23-2010, 11:05 AM
Hi Guys,
I need your help once again..
I have made this page:-
http://www.test.steptoes.co.uk/test.html
And I have taken the CSS and applied it to this page:-
http://www.test.steptoes.co.uk/product-display_Art-W204_dGFibGU9cHJvZHVjdCZmaWVsZD1Db2RlMSZ2YWx1ZT1XMjA0.ghtml
Basically I need to change the Javascript to output a label tag around the text that is outputted.
The buttons work fine, I just need to adjust the text..
at the moment it is just outputting the number e.g. "7"
Whereas I want to output the label tag aswell e.g. <label for="size_7">7</label>
Javascript in question:-
In head:
<script type="text/javascript">
/*<![CDATA[*/
function MySizes(id,sizes){
ary=sizes.split(",");
var obj=document.getElementById(id);
for (var ip,z0=0;z0<ary.length;z0++){
ip=zxcFormField('INPUT',id,'radio');
ip.value=ary[z0];
ip.style.marginRight='5px';
obj.appendChild(document.createTextNode(ary[z0]));
obj.appendChild(ip);
}
}
function zxcFormField(tag,nme,type){
var el;
try {
el=document.createElement('<'+tag+(type?' type='+type:'')+' name='+nme+' >');
}
catch (e){
el=document.createElement(tag);
if (type) el.type=type;
el.name=nme;
}
return el;
}
/*]]>*/
</script>
Trigger:
<div id="size_[_own ID_]"></div>
<script type="text/javascript">
/*<![CDATA[*/
MySizes('size_[_own ID_]','[_own Size_]')
/*]]>*/
</script>
Any ideas? I hope someone can help.
I need your help once again..
I have made this page:-
http://www.test.steptoes.co.uk/test.html
And I have taken the CSS and applied it to this page:-
http://www.test.steptoes.co.uk/product-display_Art-W204_dGFibGU9cHJvZHVjdCZmaWVsZD1Db2RlMSZ2YWx1ZT1XMjA0.ghtml
Basically I need to change the Javascript to output a label tag around the text that is outputted.
The buttons work fine, I just need to adjust the text..
at the moment it is just outputting the number e.g. "7"
Whereas I want to output the label tag aswell e.g. <label for="size_7">7</label>
Javascript in question:-
In head:
<script type="text/javascript">
/*<![CDATA[*/
function MySizes(id,sizes){
ary=sizes.split(",");
var obj=document.getElementById(id);
for (var ip,z0=0;z0<ary.length;z0++){
ip=zxcFormField('INPUT',id,'radio');
ip.value=ary[z0];
ip.style.marginRight='5px';
obj.appendChild(document.createTextNode(ary[z0]));
obj.appendChild(ip);
}
}
function zxcFormField(tag,nme,type){
var el;
try {
el=document.createElement('<'+tag+(type?' type='+type:'')+' name='+nme+' >');
}
catch (e){
el=document.createElement(tag);
if (type) el.type=type;
el.name=nme;
}
return el;
}
/*]]>*/
</script>
Trigger:
<div id="size_[_own ID_]"></div>
<script type="text/javascript">
/*<![CDATA[*/
MySizes('size_[_own ID_]','[_own Size_]')
/*]]>*/
</script>
Any ideas? I hope someone can help.