Chcialbym dodac event tracker z google analytics do funkcji switch.
Dzialajcy skrypt umieszczaony bezposrednio w formularzu:
<input type="button" value="test" onClick="_gaq.push(['_trackEvent', 'Form', 'Click', 'value 1']);"/>
Dzialaacy skrypt pobierany z osobnego pliku:
RequestForm.prototype.setButtonText = function() { var sText = ''; switch( this._currentPage ) { case 0: sText = 'Button 1'; break; case 1: sText = 'Button 2'; break; case 2: sText = 'Button 3'; break; case 3: sText = 'Button 4'; break; case 4: sText = 'Button 5'; break; default: sText = 'dalej'; break; } this._submitbutton.value = sText; }
Teraz chcialbym zrobic to tak:
gdy _currentPage = 0 to _gaq.push(['_trackEvent', 'Form', 'Click', 'value 0']);
gdy _currentPage = 1 to _gaq.push(['_trackEvent', 'Form', 'Click', 'value 1']);
itd...
Probowalem cos takiego:
RequestForm.prototype.setButtonText = function() { var sText = ''; switch( this._currentPage ) { case 0: sText = 'Button 1'; _currentPage = 0 to _gaq.push(['_trackEvent', 'Form', 'Click', 'value 0']); break; case 1: sText = 'Button 2'; break; case 2: sText = 'Button 3'; break; case 3: sText = 'Button 4'; break; case 4: sText = 'Button 5'; break; default: sText = 'dalej'; break; } this._submitbutton.value = sText; }
Jednak to nie dziala.
Wielkie dzieki z gory za pomoc