简体   繁体   English

Bookmarklet - 在URL的中间添加输入?

[英]Bookmarklet - Add an input to middle of a URL?

This is probably extremely simple but I am a total newbie. 这可能非常简单,但我是一个新手。 I use something like this to add an input to the end of an URL 我使用这样的东西在URL的末尾添加输入

javascript:
(function() { 
    var val= prompt("Enter #",""); 
    if (val) 
        location="http://www.test.com?param="+escape(val);
})()

But now I want to add something to the middle of another url like: 但现在我想在另一个网址的中间添加一些内容,例如:

http://www.test.com/ENTERSOMETHINGHERE/html/stuff/

I have no clue what I am doing. 我不知道我在做什么。

Just concatenate the strings together: 只需将字符串连接在一起:

javascript:
(function() { 
    var val= prompt("Enter #",""); 
    if (val) 
        location="http://www.test.com/"+escape(val)+"/html/stuff";
})()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM