GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Help with some code (https://gfy.com/showthread.php?t=1282919)

starling 10-28-2017 04:10 AM

Help with some code
 
This one should be quite simple but i'm struggling to get it right. I need a button with an input to take a number and store it into a domain. Like the ccbill thing you see where you put your number in and it will replace:
whateverdomain.com/xxxxxxalidland
to
whateverdomain.com/123456alidland
Ive tried javascript getElementByID but as i'm storing the button input as a variable it always comes up wrong I keep getting value="whatever" replacing the whole domain

I know I could use php to echo a variable into the code but i'm not sure if this can be implemented into a wordpress page can it? Would I have to build a plugin?

Any help would be appreciated

starling 10-28-2017 05:31 AM

Code:

<p>So this would be the paragraph and<span id="your_paragraph">THIS</span>is the word to be changed</p>
INPUT HERE: <input type="text" id="theText" />
<input type="button" id="btn" value="Update" />

<script>
var span = document.getElementById('your_paragraph');
var btn = document.getElementById('btn');
var txt = document.getElementById('theText');
btn.onclick = function(){
    span.textContent = txt.value;
};
</script>

The problem is it only works on one element instead of multiple. Is there a way to make it change all instances of the word to the same input, if I had multiple paragraphs?

sarettah 10-28-2017 06:51 AM

Quote:

Originally Posted by starling (Post 22053167)
Code:

<p>So this would be the paragraph and<span id="your_paragraph">THIS</span>is the word to be changed</p>
INPUT HERE: <input type="text" id="theText" />
<input type="button" id="btn" value="Update" />

<script>
var span = document.getElementById('your_paragraph');
var btn = document.getElementById('btn');
var txt = document.getElementById('theText');
btn.onclick = function(){
    span.textContent = txt.value;
};
</script>

The problem is it only works on one element instead of multiple. Is there a way to make it change all instances of the word to the same input, if I had multiple paragraphs?

You would need to go through all elements that can contain the word to be replaced and replace each one individually I would think.

.

starling 10-28-2017 06:59 AM

Quote:

Originally Posted by sarettah (Post 22053205)
You would need to go through all elements that can contain the word to be replaced and replace each one individually I would think.

.

I managed to get it with a jquery find/replace code thank you :)

Barry-xlovecam 10-28-2017 07:14 AM

What is the purpose? Hide the affiliate links?
Googlebot has been proven to read and execute JavaScript now -- if that is the purpose it is a waste of time.

This may work for inserting php code -- not an endorsement -- use at your own risk.
https://adinserter.pro/about

starling 10-28-2017 07:26 AM

Quote:

Originally Posted by Barry-xlovecam (Post 22053231)
What is the purpose? Hide the affiliate links?
Googlebot has been proven to read and execute JavaScript now -- if that is the purpose it is a waste of time.

This may work for inserting php code -- not an endorsement -- use at your own risk.
https://adinserter.pro/about

I'm making a backend for affiliates, I'll give it a look.

TACNet 10-28-2017 07:27 AM

Quote:

Originally Posted by Barry-xlovecam (Post 22053231)
Googlebot has been proven to read and execute JavaScript now

Hi

Is that true ? Ive often wondered

Sorry off topic i know

Barry-xlovecam 10-28-2017 08:33 AM

Quote:

Originally Posted by TACNet (Post 22053255)
Hi

Is that true ? Ive often wondered

Sorry off topic i know

Thats what I have read at the big SEO sites -- they did tests.

My old JS 'you better have my cookie' script was detected by Google and all of those pages ended up delisted (I think so) a couple of years ago when this news was disclosed. Harder to run googlebot in circles these days. Time to develop anti-googlebot warfare and lots of cheap new gTLD domains on cloud VPS servers that will have new ips. Today most big hosts are multinational with multi IP 'A - B' blocks -- problem is the AS blocks (ASN) are assigned to the Hosting Co.

So does Google check AS blocks now? IDK.


All times are GMT -7. The time now is 03:23 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc