/    Sign up×
Community /Pin to ProfileBookmark

Css change , how ?

hi guys,
its my first thread in this forum and I am looking for help.I want to enable the user to change the css file of the page [U]without reloaing the page[/U].

it’s an ajax code like this one in yahoo’s page and msn’s one.I am looking for a full css change not only apicture .

thanks in advance

Almasry

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mrhooJan 25.2007 — [CODE]function newLink(urlstr,titlestr,oldLink){
var pa= document.getElementsByTagName('head')[0];
var newLink=document.createElement('link');
newLink.setAttribute('rel,'stylesheet');
newLink.setAttribute('type','text/css');
newLink.setAttribute('media','screen');
newLink.setAttribute('href',urlstr);
if(titlstr)newLink.setAttribute('title',titlestr);
if(oldLink && oldLink.tagName=='LINK') {
pa.replaceChild(newLink,oldLink);
}
else pa.appendChild(newLink);
}[/CODE]
This will insert a new stylesheet in a link element with the URL you pass as the first argument.

The second argument is optional, but a title makes it easier to find the link element later.

If you need to replace an existing link element, pass a reference to the old link with the third argument.
×

Success!

Help @almasry spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...