如何在另一个Javascript中组合Javascript提示符?

如何在另一个Javascript中组合Javascript提示符?,javascript,function,prompt,bookmarklet,Javascript,Function,Prompt,Bookmarklet,如果我有这个javascript/bookmarklet javascript: (function() { var val= prompt("Enter #",""); if (val) location="http://www.test.com/"+escape(val)+"/html/stuff"; })() 但是,它不会将输出值发送到uURL,而是将输出发送到另一个javascript,我该怎么做呢 这是我想要执行的javascript(第1部分+

如果我有这个javascript/bookmarklet

javascript:
(function() { 
    var val= prompt("Enter #",""); 
    if (val) 
        location="http://www.test.com/"+escape(val)+"/html/stuff";
})()
但是,它不会将输出值发送到uURL,而是将输出发送到另一个javascript,我该怎么做呢

这是我想要执行的javascript(第1部分+输出+第2部分)


你想做什么,甚至哪里出了问题都不清楚。请给我一个简单的,最少的例子。如果可能的话,在bookmarklet代码中使用模板字符串分隔符(graves)缩进并包含换行符。您想做什么甚至出了什么问题都不清楚。请给我一个简单的,最少的例子。如果可能,使用模板字符串分隔符(graves)在bookmarklet代码中缩进并包含换行符。
javascript:function filtreAuto(){var e=[];e["aucun"]="aucun";e["A_Site"]="http://A_site.com/";return e}function bookmarklet(){var e=document.createElement("div");url=filterUrl();e.innerHTML='<h1>URL</h1><input type="checkbox" name="checkboxUrl" id="'+url+'" value="checkbox0"><label for="checkbox0"><a href="'+url+'">'+url+"</a></label><br />";var t=document.createElement("div");var n=document.createElement("h2");n.setAttribute("id","Filtrer les liens par mots clé:");t.appendChild(n);var r=document.createElement("input");r.setAttribute("id","searchInput");r.setAttribute("name","searchInput");r.setAttribute("type","text");r.setAttribute("placeholder","Filtre personnaliser...");t.appendChild(r);t.innerHTML=t.innerHTML+" ou Filtre Auto: ";var i=document.createElement("select");i.setAttribute("id","searchAuto");i.onchange=function(){win.document.getElementById("searchInput").value=""};filtre=filtreAuto();for(var s in filtre){var o=document.createElement("option");o.value=filtre[s];o.text=s;i.appendChild(o)}t.appendChild(i);var u=document.createElement("button");u.onclick=function(){findLinks()};u.innerHTML="search";t.appendChild(u);var a=document.createElement("button");a.setAttribute("id","cocher");a.onclick=function(){linksCheck()};a.innerHTML="Tout cocher";t.appendChild(a);var f=document.createElement("button");f.setAttribute("id","pyLoad");f.onclick=function(){toPyload()};f.innerHTML="Envoi à pyLoad";t.appendChild(f);var l=document.createElement("div");l.setAttribute("id","divList");win.document.body.appendChild(e);win.document.body.appendChild(t);win.document.body.appendChild(l);findLinks()}function linksCheck(){var e=win.document.getElementById("cocher");e.innerHTML=="Tout cocher"?e.innerHTML="Tout décocher":e.innerHTML="Tout cocher";var t=win.document.getElementById("conteneur").firstChild;while(t!=null){if(t.getAttribute("type")=="checkbox"){test=e.innerHTML=="Tout cocher"?false:true;win.document.getElementsByName("checkboxUrl")[0].checked=test;win.document.getElementById(t.getAttribute("id")).checked=test}t=t.nextSibling}return false}function filterUrl(){url=winx.document.URL;if(url.lastIndexOf("youtube")!=-1){g=new RegExp("v=.{11}");idVideo=g.exec(url);urlYoutube="http://www.youtube.com/watch?"+idVideo;url=urlYoutube}return url}function findLinks(){win.document.getElementById("cocher").innerHTML="Tout cocher";var e=win.document.getElementById("searchAuto").value;var t=win.document.getElementById("searchInput").value;title="<h2>Tous les liens "+t+":</h2>";if(!t){if(e=="aucun"){t="";title="<h2>Pas de filtre:</h2>"}else{t=e;title="<h2>Filtre des liens :"+t+"</h2>"}}else{win.document.getElementById("searchAuto").value="aucun"}texte=title+'<div id="conteneur">';for(var n=0;n<list_Links.length;n++){list_Links[n].lastIndexOf(t)!=-1?texte+='<input type="checkbox" name="checkbox'+n+'" id="'+list_Links[n]+'" value="checkbox'+n+'"><label for="checkbox'+n+'"><a href="'+list_Links[n]+'">'+list_Links[n]+"</a></label><br />":""}var r=win.document.getElementById("divList");r.innerHTML=texte+"</div>"}function createListLinks(){list_Links=[];for(var e=winx.document.links.length-1,t;t=winx.document.links[e];e--){if(!t.href.match(/^(javascript:|data:)/)){lien=t.href;list_Links.push(lien)}}return list_Links}function toPyload(){list_Pyload=[];var e=win.document.getElementsByName("checkboxUrl")[0];e.checked?list_Pyload.push(e.id):"";var t=win.document.getElementById("conteneur").firstChild;while(t!=null){if(t.getAttribute("type")=="checkbox"){t.checked?list_Pyload.push(t.getAttribute("id")):""}t=t.nextSibling}if(list_Pyload==""){return false}jLinks=JSON.stringify(list_Pyload);urlx='http://localhost:8000/api/addPackage?name="
"&links='+jLinks;winz=window.open(urlx,"","resizable=no, location=no, width=100, height=100, menubar=no, status=no, scrollbars=no, menubar=no");setTimeout("winz.close()",50);win.close()}winx=window;win=window.open("","_blank","width=800,height=600,scrollbars,resizable,menubar");list_Links=createListLinks();bookmarklet()