HOME ➔ SUPPORT ➔ Community ➔ General CourseLab issues ... change font size and color
change font size and color
  View type:
Hi every one
I need your help urgently;I've made a course using course lab and I put JavaScript codes on it to change fonts(minimize and maximize)and others change colors of the text when we press on the picture that I've put the actions on it.
But unfortunately it does not work,so what do you think the causes of this problem?
[:confused:]
 
Could be many things, hard to say without any line of code.
Did you have a look at thread "Setting properties of objects"?
 
 
Thank you for your reply ,I've read the thread you mention but it wasn't my problem>Because I've already used java scripts codes but it doesn't do the actions required.
This is one of the functions I've used, It's for maximizing the font size>
I put this code on an image's action.

var div = document.getElementsByTagName('div');
for(i=0;i<div.length;i++) {
if(div[i].style.fontSize) {
var s =
parseInt(div[i].style.fontSize.replace("px",""));
} else {
var s = 15;
}
if(s!=18){
s += 1;
}
div[i].style.fontSize = s+"px";

}
I couldn't catch where is the error,so I hope you check it with me.
Thank you in advance
Eman ALEC
 
 
 
I just made a course with one slide.
On the slide three textboxes.
Also one shape I use as button, with onClick action: javascript

var div = document.getElementsByTagName('div');
for(i=0; i&lt;div.length; i++)
{
alert(i);
div[i].style.color = &quot;#FF0000&quot;;
}

There were more than 50 divs.
The first click changed the textcolor of 2 divs to red; the other clicks didn't change the color of the third.

I think using divs this was is kind of rough, (in Dutch we say shooting shot).
If possibel I would first give the textboxes you want to change either an Id or a class and try to reach these specific divs.
[:)]
 
 
 
Oh, forget my answer, I just saw you want to affect all div's, not named by id.
 
 
 
I will check it, but important is how you define the div. Can you add that info?
Subject:
Message options
No additional options