Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-12-2012, 03:23 PM   PM User | #1
carljj
New Coder

 
Join Date: Dec 2011
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
carljj is an unknown quantity at this point
Question Script dont work HELP HERE!!!

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:
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>
carljj is offline   Reply With Quote
Old 07-12-2012, 04:05 PM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,613
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Learn to use the error console built into most browsers nowadays. The first thing I get when I load your page is:
Quote:
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:
Quote:
enable is not defined
And when I look in the source code I see:
Code:
<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>
__________________
Don’t click this link!
VIPStephan is online now   Reply With Quote
Old 07-12-2012, 05:47 PM   PM User | #3
carljj
New Coder

 
Join Date: Dec 2011
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
carljj is an unknown quantity at this point
Question

ok how do i fix this ?
carljj is offline   Reply With Quote
Old 07-12-2012, 06:13 PM   PM User | #4
c1lonewolf
Regular Coder

 
Join Date: Sep 2002
Posts: 216
Thanks: 0
Thanked 11 Times in 11 Posts
c1lonewolf is an unknown quantity at this point
Looks like your blog site uses line returns to determine new paragraphs, so remove the line returns.
Code:
<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,toolbar=no');clicks+=count;if(clicks==6){thebutt=document.getElementById("key");thebutt.disabled=false;thebutt.value="Unlocked";}}</script>
Also known as 'compressing code'.
__________________
NO Limits!!
c1lonewolf is offline   Reply With Quote
Old 07-12-2012, 11:19 PM   PM User | #5
carljj
New Coder

 
Join Date: Dec 2011
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
carljj is an unknown quantity at this point
Smile

Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu:d:d:d:d:d:d:d:d:d:d:d:d:d:d:d
carljj is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:02 PM.


Advertisement
Log in to turn off these ads.