-1

I need your help with a simple code allowing me to setup a HTML5 page where I have iframe tag with a src address target that will change everyday depending on the day of the date. For example:

<iframe src="https://www.mypage.com/**day**.html"></iframe>

Where day changes everyday.

Any help will be appreciated.

Ale
  • 944
  • 3
  • 14
  • 34
  • 1
    use simple `javascript` to set src `document.getElementById("iframe").setAtrribute("src","new src")` – Arun Kumar Oct 15 '18 at 10:04
  • `src` is (also) a property. One does not require `setAttribute()` for that. – Lain Oct 15 '18 at 10:07
  • Possible duplicate of [Changing iframe src with Javascript](https://stackoverflow.com/questions/3730159/changing-iframe-src-with-javascript) – DarkSuniuM Oct 15 '18 at 10:50

1 Answers1

0

This is a simple way to change the src attribute of an iframe.

var daily_iframe = document.getElementById('daily-iframe');
daily_iframe.src = "https://www.youtube.com"; 
<iframe src="https://www.google.com" id="daily-iframe"></iframe> 
Erlisar Vasquez
  • 460
  • 3
  • 13
  • thank you I coold not get what i'm looking for any othe piece of code to help, the var part is the part of src code of the address https://www.mypage.com/day.html is day that change everyday. 01, 02, 03, depending of the day of the today date. any help please – Khaled Bouzouaya Oct 15 '18 at 12:48