+ 1
How to add "document.write(prompt());" To be able to write the link in a dialog box and make the corresponding replacements
16 Answers
+ 2
So I did the splitting etc. See if that's in the area of what you wanted.
+ 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.
+ 4
https://code.sololearn.com/WTpVC36r5bb6/?ref=app
Do you mean like this?
+ 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
+ 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
+ 2
Here is you original 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
After hitting run, see if you can tell what I input 😉
https://simple.com/Gabriel?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
or
https://simple.com/Jose?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
or
https://simple.com/Pantoja?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
Is that what you mean?
+ 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
+ 2
Happy we got there!
You're most welcome.
+ 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.
+ 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.
+ 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
+ 1
Ausgrindtube My God, it's beautiful 😱 thank you very much, it's exactly what I was looking for. 🙏
0
Sorry, I didn't umderstand the question. What you want to do with that URL actually? why replace some parts of it?
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
- 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