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>
4

1 回答 1

0

试试这个 jsfiddle。您必须myFunction()head部分中定义。

 <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>
于 2013-02-13T12:50:40.927 回答