Using a Button Image to Refresh Page |
Using a Button Image to Refresh Page |
rivera2419 |
Dec 4 2019, 06:58 PM
Post
#1
|
Group: Members Posts: 5 Joined: 4-December 19 From: El Paso, TX Member No.: 27,060 |
Hi,
I'm using the following to refresh a page on my website: <button onClick="window.location.reload();">Refresh Page</button> The above obviously generates a "Refresh Page" button but I want to use a .png image as the button. Can anyone please advise me on how to accomplish this? Thanks, A newbie... |
CharlesEF |
Dec 6 2019, 02:40 AM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
It may work, but not for the reason you think. If your page is HTML4 then the 'a' tag can contain an empty href. Clicking on it would result in a page reload, that is the default action. If your page is HTML5 then an empty href in invalid. You could use javascript, as your example shows (javascript is 1 word your code may not execute but the page will reload anyway) or you could just use the page name for the href.
|
Christian J |
Dec 6 2019, 09:47 AM
Post
#3
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
|
CharlesEF |
Dec 6 2019, 02:18 PM
Post
#4
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
(javascript is 1 word your code may not execute I recall the forum software adds a space between "java" and "script" when the (correctly spelled) "javascript" is followed by a colon, in order to prevent code injection (confusing I know). For whatever reason I seem to forget that. |
Lo-Fi Version | Time is now: 26th April 2024 - 12:03 PM |