...

View Full Version : Script dont work HELP HERE!!!



carljj
07-12-2012, 03:23 PM
I am looking why my script isn't working. I couldn't figure/find resources about it. My problem is that the script doesn't work somehow in my blog.

Here's my test wordpress site and if you click on the buttons then there is no response.
http://test.blogg-in.com/

Here's the script/code:

<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 1" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 2" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 3" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 4" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 5" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 6" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 7" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 8" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 9" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 10" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 11" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>


<center><input style="width:110px; height:30px;" type="button" id='https://www.google.de/' value="Link 12" onClick="enable(this,1);this.onclick = function(){ enable(this,0) };"></center>

<script type="text/javascript">
var clicks=0;

function goThere() {
window.location = "http://www.youtube.com/";
}

function enable(butt,count){
window.open(butt.id,'pwin','location=no,status=no,scrollbars=no,resizeable=yes,toolbar=no')
clicks+=count;
if (clicks==6){
thebutt=document.getElementById("key")
thebutt.disabled=false;
thebutt.value="Unlocked";
}
}
</script>




<center><input style="width:110px; height:30px;" type="button" value="Locked" id="key" disabled="true" onclick = "goThere()"></center>

VIPStephan
07-12-2012, 04:05 PM
Learn to use the error console built into most browsers nowadays. The first thing I get when I load your page is:


Error: syntax error
Source: http://test.blogg-in.com/
Line: 125, Column: 13
Source code:
var clicks=0;</p>


And when I click a button it says:


enable is not defined


And when I look in the source code I see:


<p><script type="text/javascript">
var clicks=0;</p>
<p>function goThere() {
window.location = "http://www.wix.com/worldwidedownloads/ninja-saga-gold-tokens";
}</p>
<p>function enable(butt,count){
window.open(butt.id,'pwin','location=no,status=no,scrollbars=no,resizeable=yes,toolbar=no')
clicks+=count;
if (clicks==6){
thebutt=document.getElementById("key")
thebutt.disabled=false;
thebutt.value="Unlocked";
}
}
</script></p>

carljj
07-12-2012, 05:47 PM
ok how do i fix this ?

c1lonewolf
07-12-2012, 06:13 PM
Looks like your blog site uses line returns to determine new paragraphs, so remove the line returns.


<script type="text/javascript">var clicks=0;function goThere(){window.location="http://www.wix.com/worldwidedownloads/ninja-saga-gold-tokens";};function enable(butt,count){window.open(butt.id,'pwin','location=no,status=no,scrollbars=no,resizeable=yes,to olbar=no');clicks+=count;if(clicks==6){thebutt=document.getElementById("key");thebutt.disabled=false;thebutt.value="Unlocked";}}</script>

Also known as 'compressing code'.:)

carljj
07-12-2012, 11:19 PM
Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu:d:d:d:d:d:d:d:d:d:d:d:d:d:d:d



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum