+ 1
I want to randomly change my a tag link with refreshing browser using javascript pls tell me
Using an array , random function
7 ответов
+ 3
Assuming you know how to make that URL array, next thing to learn is to choose random element from the array.
https://www.w3schools.com/JS/js_random.asp
Make sure the hyperlink can be uniquely identified, by setting its "id" attribute for example. Next you obtain the hyperlink reference (by its "id") and set its 'src' attribute via Javascript.
<hyperlink-element>.src = <random-url-from-array>;
Still not getting the browser refresh thing though ...
+ 3
So you have a hyperlink in a page,
And now you want the 'src' attribute to contain random URL taken from an array, is that what you want?
But what about the browser refresh? I didn't get it.
+ 2
Webber,
I can't respond to DM, it is read-only for me. My replies never got through back to the sender.
+ 2
Webber bro,
Then please join Javascript course to learn about arrays. I thought you knew about it because you mentioned "using array, random function" in the Description above.
+ 1
Ok
+ 1
Please tell me how can I do it
0
No bro I don't know to make.a url array pls help me