+ 1

How to add "document.write(prompt());" To be able to write the link in a dialog box and make the corresponding replacements

https://code.sololearn.com/WqmE1BDHl7Ik/?ref=app

13th Nov 2022, 5:57 AM
Gabriel Jose Pantoja
Gabriel Jose Pantoja - avatar
16 Answers
+ 2
So I did the splitting etc. See if that's in the area of what you wanted.
16th Nov 2022, 6:07 PM
Ausgrindtube
Ausgrindtube - avatar
+ 5
Gabriel Jose Pantoja ok, I understand now! I'll see what I can do if/when I get some time. Right now, I'm thinking you would want to search the input text and then do the replacement and print it out. You could do that by using split and then the /- and also dl= and do it there, I guess. jodi russell why did you drop a random link to another post in this thread? Janusz please create your own post for questions unrelated to the original post. It's not nice to try and hijack their thread.
14th Nov 2022, 8:01 PM
Ausgrindtube
Ausgrindtube - avatar
13th Nov 2022, 10:45 AM
Ausgrindtube
Ausgrindtube - avatar
+ 4
Ipang noticed that I didn't save the correct code, it should be updated now and work with the input as you want Gabriel... I think
13th Nov 2022, 4:42 PM
Ausgrindtube
Ausgrindtube - avatar
+ 3
Janusz Sometimes the same thing happens to me, but with the button to create new code; I solved it by forcing the application to stop and clearing the cache
14th Nov 2022, 9:23 PM
Gabriel Jose Pantoja
Gabriel Jose Pantoja - avatar
+ 2
Since prompt() method returns string you can attach replace() method to prompt() method via dot notation. https://code.sololearn.com/WTqtozuth4Wo/?ref=app https://code.sololearn.com/WJ0JkhDEPCpc/?ref=app
15th Nov 2022, 1:34 AM
ODLNT
ODLNT - avatar
+ 2
Happy we got there! You're most welcome.
16th Nov 2022, 6:33 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Ipang This is an affiliate link, and I'm trying to change that part of the link for more productivity; you see what I want the code to do is to open a text box where I can enter The link and give me a result with the replacement.
13th Nov 2022, 12:45 PM
Gabriel Jose Pantoja
Gabriel Jose Pantoja - avatar
+ 1
It's no problem. Sometimes explaining what the issue is half of the issue! 😅 I believe I understand the -1jPX being replaced by -4iBM part. My question, you mentioned you wanted user input. Am I correct in understanding that the -4iBM would then change to whatever the user input? The user enters blah and -1jPX changes to blah accordingly. The user enters foo and -1jPX = foo now. Is that right? I'm pretty sure my code does that.
14th Nov 2022, 11:55 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
No, it is quite the opposite, 😆 for example, if the user enters this link: https://simple.com/-1idI?dl=https%3A%2F%2Fwww.abcdin.cl%2Fnotebook-gamer-asus-rog-zephyrus-g14-ga401-14-pulgadas-amd-ryzentm-7-5800hs-16-gb-ram-512-gb-ssd-nvidia-geforce-rtx-3050-1166536 The script should return this: https://simple.com/-4iBM?dl=https%3A%2F%2Fwww.abcdin.cl%2Fnotebook-gamer-asus-rog-zephyrus-g14-ga401-14-pulgadas-amd-ryzentm-7-5800hs-16-gb-ram-512-gb-ssd-nvidia-geforce-rtx-3050-1166536 As you can see, simple.com/-1idI is now: simple.com/-4iBM The point is that the user only has to enter the full link, the user somehow does not know that the script is going to return the -4iBM as a replacement for -1idI
14th Nov 2022, 12:42 PM
Gabriel Jose Pantoja
Gabriel Jose Pantoja - avatar
+ 1
Ausgrindtube My God, it's beautiful 😱 thank you very much, it's exactly what I was looking for. 🙏
16th Nov 2022, 6:28 PM
Gabriel Jose Pantoja
Gabriel Jose Pantoja - avatar
0
Sorry, I didn't umderstand the question. What you want to do with that URL actually? why replace some parts of it?
13th Nov 2022, 10:01 AM
Ipang
0
Ausgrindtube Sorry if I didn't explain myself well, the issue is: I have a series of various links Containing a fixed code, example: ("https://ad.soicos.com/-1jPX?dl="), what I'm looking for is that the script replaces only this part: ('-1jPX') with this other ('-4iBM') and gives me a result, and that it works from a document.write(prompt()) 🙏 https://code.sololearn.com/WqmE1BDHl7Ik/?ref=app
14th Nov 2022, 11:17 AM
Gabriel Jose Pantoja
Gabriel Jose Pantoja - avatar
- 1
Ausgrindtube yes, something like that, I want to introduce a prompt where I can enter the link and it gives me a result according to the replacement data that I have added
13th Nov 2022, 12:57 PM
Gabriel Jose Pantoja
Gabriel Jose Pantoja - avatar
14th Nov 2022, 3:28 PM
jodi russell
jodi russell - avatar