Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2011
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,624
    Thanks
    6
    Thanked 1,001 Times in 974 Posts
    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:
    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>

  • #3
    New Coder
    Join Date
    Dec 2011
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    ok how do i fix this ?

  • #4
    Regular Coder
    Join Date
    Sep 2002
    Posts
    454
    Thanks
    0
    Thanked 20 Times in 20 Posts
    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!! DHCreationStation.com
    ------------------------------------------------------------
    Broken items wanted for tinkerin'! PostItNow@BrokenEquipment.com
    Global Complaint Dept.

  • #5
    New Coder
    Join Date
    Dec 2011
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu:d:d:d:d:d:d:d:d:d:d:d:d:d:d:d


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •