The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Using a Button Image to Refresh Page
rivera2419
post 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...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
CharlesEF
post 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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 6 2019, 09:47 AM
Post #3


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(CharlesEF @ Dec 6 2019, 08:40 AM) *

(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).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post 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



QUOTE(Christian J @ Dec 6 2019, 08:47 AM) *

QUOTE(CharlesEF @ Dec 6 2019, 08:40 AM) *

(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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 12:03 PM