Когда функция Change вызывается на событие onload (или любое другое) всё нормально. Вопрос: можно ли сделать так, чтобы она вызывалась не на событие а самостоятельно? вроде такого:
function Change(obj,property,value)
{
obj = document.getElementById(obj);
obj.style[property] = value;
return obj;
}
Change('test','color','red'); // стили должны изменится
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Актуальные контакты:
Telegram: @Nikker_web
E-Mail: tarasevich.email@gmail.com
Портфолио https://www.behance.net/d4d4186e
Разрабатываю дизайн групп в соц сетях, сайтов, приложений, другой дизайн под заказ
Актуальные контакты:
Telegram: @Nikker_web
E-Mail: tarasevich.email@gmail.com
Разрабатываю дизайн групп в соц сетях, сайтов, приложений, другой дизайн под заказ
Портфолио https://www.behance.net/d4d4186e
Question
YISHIMITSY
Здравствуйте! Есть код:
function Change(obj,property,value)
{
obj = document.getElementById(obj);
obj.style[property] = value;
return obj;
}
window.onload = function()
{
Change('test','color','red')
}
Когда функция Change вызывается на событие onload (или любое другое) всё нормально. Вопрос: можно ли сделать так, чтобы она вызывалась не на событие а самостоятельно? вроде такого:
function Change(obj,property,value)
{
obj = document.getElementById(obj);
obj.style[property] = value;
return obj;
}
Change('test','color','red'); // стили должны изменится
Как мне заставить работать такой код?
Link to comment
Share on other sites
15 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.