Home > Article > Web Front-end > How to modify the CSS reference of the html frontend?_html/css_WEB-ITnose
The head part of the original html frontend references a style.css style
<LINK href="Css/style.css" type="text/css" rel="stylesheet">
HtmlLink link = new HtmlLink();link.Attributes.Add("type", "text/css");link.Attributes.Add("rel", "stylesheet");link.Attributes.Add("href", "style7.css");this.Header.Controls.Add(link);
<LINK href="Css/style.css" type="text/css" rel="stylesheet">
<LINK href="Css/style.css" type="text/css" rel="stylesheet">
The middle one 0 is i.
var link = document.getElementsByTagName('link');for(var i = 0; i<link.length; i++){ if(link[i].href.indexOf('style.css') > -1){ link[i].parentNode.removeChild(link[i]); }}
Your business logic
Add a
and go to a
Then the synthesis is to modify a
and borrow the code above
var link = document.getElementsByTagName('link');
for(var i = 0; i327fefd8bfcee6d6b7d9cb261584e394 -1){
link[i].href = 'style7.css';