2013-02-13 61 views
0

夥計們以下是我的腳本,但它不工作任何人都可以告訴爲什麼?
想要檢查嗎?請使用這個腳本在: - http://calcus.host56.com/make_your_own_link.htm對話框腳本不工作

 <html><head> 
    <title>Hello</title> 
    <style> 
    a {color:black;font-size:23;} 
    textarea {color:white;font-size:1;border:none;} 
    </style> 
    <script> 

    function select8() 
    { 
    document.getElementById("demo").select(); 
    } 

    </script> 

    </head> 
    <body> 
    <script> 
    function myFunction() 
    { 
    var x; 

    var name=prompt("Please enter your Facebook username",""); 

    if (name!=null) 
     { 
     x="https://www.facebook.com/dialog/apprequests?api_key=148768088503846&app_id=148768088503846&data=%7B%7B"+"category"+"%3A"+"virtue"+"%7D%7D&display=popup&filters"+"&frictionless=false&locale=en_US&message=Here+is+a+Virtue+for+you+Mihir+Gupta%21%21+By+Chirag+Jain&next=http%3A%2F%2Fvolcanoisland.brokenbulbstudios.com%2F%252Ff312818684%26relation%3Dopener%26transport%3Dpostmessage%26frame%3Df18dc1ab6%26result%3D%2522xxRESULTTOKENxx%2522"+"&sdk=joey&title=Send+your+friends+a+daily+gift&to="+name;document.getElementById("demo").innerHTML=x; 
     } 
    } 
    </script> 
    <button onclick="myFunction()" accesskey="v">Click Here to Make Your Own Virtue Link </button> 
    <br> 
    <textarea id="demo">Your Url Here</textarea> 

    <button onclick="select8()" accesskey="x">Entered username?? <br>Now Click here and press Ctrl + c to copy the link </button> 
+0

你能解釋一下**什麼**不起作用,以及它應該如何行事? – MCL 2013-02-13 12:51:54

回答

0

嘗試this jsfiddle。您必須在head部分中定義myFunction()

<html> 
    <head> 
    <title>Hello</title> 
    <style> 
    a {color:black;font-size:23;} 
    textarea {color:white;font-size:1;border:none;} 
    </style> 
    <script> 

    function myFunction() 
    { 
    var x; 

    var name=prompt("Please enter your Facebook username",""); 

    if (name!=null) 
     { 
     x="https://www.facebook.com/dialog/apprequests?api_key=148768088503846&app_id=148768088503846&data=%7B%7B"+"category"+"%3A"+"virtue"+"%7D%7D&display=popup&filters"+"&frictionless=false&locale=en_US&message=Here+is+a+Virtue+for+you+Mihir+Gupta%21%21+By+Chirag+Jain&next=http%3A%2F%2Fvolcanoisland.brokenbulbstudios.com%2F%252Ff312818684%26relation%3Dopener%26transport%3Dpostmessage%26frame%3Df18dc1ab6%26result%3D%2522xxRESULTTOKENxx%2522"+"&sdk=joey&title=Send+your+friends+a+daily+gift&to="+name;document.getElementById("demo").innerHTML=x; 
     } 
    } 

    function select8() 
    { 
    document.getElementById("demo").select(); 
    } 

    </script> 
    </head> 
    <body> 
    <button onclick="myFunction()" accesskey="v">Click Here to Make Your Own Virtue Link </button> 
    <br> 
    <textarea id="demo">Your Url Here</textarea> 

     <button onclick="select8()" accesskey="x"> Entered username?? <br />Now Click here and press Ctrl + c to copy the link </button> 
    </body> 
</html> 
+0

感謝它的工作 – 2013-02-14 05:17:12