<head> <link href="{dede:cmsurl}/default/blueidea1.css" type="text/css" rel="stylesheet"/> <link href="{dede:cmsurl}/default/blueidea2.css" type="text/css" rel="stylesheet"/> <link href="{dede:cmsurl}/default/blueidea3.css" type="text/css" rel="stylesheet"/> </head> HTML: I want to replace the href attributes in the <link> tag , can anyone help write a js snippet for me? I am a newbie of js. the result should be below: <head> <link href="{dede:cmsurl}/test/blueidea1.css" type="text/css" rel="stylesheet"/> <link href="{dede:cmsurl}/test/blueidea2.css" type="text/css" rel="stylesheet"/> <link href="{dede:cmsurl}/test/blueidea3.css" type="text/css" rel="stylesheet"/> </head> HTML: My english is poor , I can only write chinese English , I am sorry for anyone who can not understand what the problem I am asking.
Add id for "link" tag for example: <link id="link1" href="{dede:cmsurl}/default/blueidea3.css" type="text/css" rel="stylesheet"/> Code (markup): then use this js code: document.getElementById('link1').href='www.example.com/style.css'; Code (markup):