0

I'd like to know how to write a downloads counter that changes a var in an external .js file??
the var is named after the id of the textbox that displays the number held within that var...

eg:
external file:

var txtbx = 0

html:

<script type="text/javascript">
count() //writes the increased value to the var in the external file 
//(var to change is based on the input ID)
</script>

<a href... onclick="count()">download</a> 
<span style="align:right">
Downloads: <input type="textbox" id="txtbx" value=txtbx>
</span>

can anyone help??

1
Contributor
2
Replies
3
Views
7 Years
Discussion Span
Last Post by DarkPikachu
0

also...
off topic...
but...

how do you shorten something like this down:

<td style="cursor:pointer; cursor:hand;" align='center' width="15%" id="switch" class="tbl_off" 
onMouseOver="rollover(this,'tbl_ovr')" onMouseOut="rollover(this,'tbl_off')" 
onClick="if 
(this.parentNode.parentNode.getElementsByTagName('div')[3].style.display != ''){
this.parentNode.parentNode.getElementsByTagName('div')[3].style.display = ''; 
this.parentNode.parentNode.getElementsByTagName('div')[4].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[5].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[6].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[7].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[8].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[9].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[10].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[11].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[12].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[13].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[14].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[15].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[16].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[17].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[18].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[19].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[20].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[21].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[22].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[23].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[24].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[25].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[26].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[27].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[28].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[29].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[30].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[31].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[32].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[33].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[34].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[35].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[36].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[37].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[38].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[39].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[40].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[41].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[42].style.height='42%';
this.parentNode.parentNode.getElementsByTagName('div')[43].style.height='42%';
} else {
this.parentNode.parentNode.getElementsByTagName('div')[3].style.display = 'none'; 
this.parentNode.parentNode.getElementsByTagName('div')[4].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[5].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[6].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[7].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[8].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[9].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[10].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[11].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[12].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[13].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[14].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[15].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[16].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[17].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[18].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[19].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[20].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[21].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[22].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[23].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[24].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[25].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[26].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[27].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[28].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[29].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[30].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[31].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[32].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[33].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[34].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[35].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[36].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[37].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[38].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[39].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[40].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[41].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[42].style.height='100%';
this.parentNode.parentNode.getElementsByTagName('div')[43].style.height='100%';}"
style="display: none;">

Edited by DarkPikachu: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.