Otomatik Kelime Değiştirme URL Değiştirme Kodu Nasıl Yapılır? (1 Viewer)

Joined
May 4, 2020
Credits
37
Rating - 0%
<button onclick="myFunction()">PLAYER</button>

<script>
function myFunction() {
var str = document.getElementById("Blog1").innerHTML;
var res = str.replace("google.com", "youtube");
document.getElementById("Blog1").innerHTML = res;
}
</script>



Yukarıdaki Kodu buton olarak tıkladığımda kelimeler değişiyor.fakat ben bunu otomatik yapmak istiyorum.nasıl yapabilirim?​
 
Joined
Jul 19, 2020
Credits
43,826
Rating - 0%
<button onclick="myFunction()">PLAYER</button>

<script>
function myFunction() {
var str = document.getElementById("Blog1").innerHTML;
var res = str.replace("https://www.google.com", "https://www.youtube.com");
document.getElementById("Blog1").innerHTML = res;
}
</script>


tam ne demek istediğini anlamadım ama sanırım böyle demek istedin
 
Joined
May 4, 2020
Credits
37
Rating - 0%
<button onclick="myFunction()">PLAYER</button>

<script>
function myFunction() {
var str = document.getElementById("Blog1").innerHTML;
var res = str.replace("https://www.google.com", "https://www.youtube.com");
document.getElementById("Blog1").innerHTML = res;
}
</script>


tam ne demek istediğini anlamadım ama sanırım böyle demek istedin
malesef.bu kod sadece bir buton oluşturuyor ve butona tıklandığında sayfadaki kodları değiştiriyor.ben bunu otomatik nasıl yaparım diye sormuştum.
yani butona tıklamadan kodlar sayfa açılır açılmaz değiştirebilecek bir kod arıyorum.
 

Users who are viewing this thread

Top