-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.css
More file actions
41 lines (32 loc) · 1.19 KB
/
Copy pathbasic.css
File metadata and controls
41 lines (32 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*basic css for homepage*/
#second{
display: none;
}
#second-show{
display: inline-block;
}
/*
I'm trying to create a system that when clicking a button in the HTML then it change both SRC and then the style of document inside the iframe.
The problem is that all work perfectly: I don't have any cross-origin issue. But the browser does not change the style of the iframe content.
There is the script code:
```
function change_css(){
var change_src = new Promise(function(resolve, reject){
document.getElementById("first").src="document_2.html";
resolve();
});
change_src.then(
function(){
setTimeout(function(){console.log("done");}, 3000);
var style = document.getElementById("first");
style.contentWindow.document.getElementById("test").setAttribute("href", "css_2.css");
}
)
}
```
I am using a promise to change the Iframe SRC first and then change the style of the iframe content. The problem is that the style actually does not change.
this is the HTML code inside the iframe document:
```
<link rel="stylesheet" id="test" type="text/css" href="css_1.css">
```
*/