rendezvous123
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by rendezvous123
-
-
This is what i currently have for the JavaScript script.
[code]function switch(id, id2, id3){
if (document.getElementById){
var obj = document.getElementById(id);
var obj2 = document.getElementById(id2);
var obj3 = document.getElementById(id3);
if (obj2.style.display == "none") {
obj.value = "Switch to Content Mode";
obj2.style.display = "block";
obj3.style.display = "none";
} else {
obj.value = "Switch to Shout Mode";
obj2.style.display = "none";
obj3.style.display = "block";
}
}
}[/code]
I've been trying to test it using this:
[code]<input id="displayer" type="button" value="Switch to Shout Mode" onclick="switch('displayer', 'n1', 'n2')"/>
<div id="n1" style="display: none;">Shout!</div>
<div id="n2">Content!</div>[/code]
When i click on the button, i want the button's value to change, and the display of both DIV elements to switch. But whenever i click the button, nothing happens. I can't see anything wrong with the script. But, then again, i'm not a JavaScript person. Any help would be appreciated. :D -
Nevermind! I figured out how. I needed to negate a character. All works fine, now. :D
-
Here's what i'm having trouble with:
[code]$shout = ereg_replace('\\[color="(.*)"\\](.*)\\[/color\\]', '<font color="\\1">\\2</font>', $shout);[/code]
When, i test it, it works fine, until, another instance of it is found on the same line.
I submit this:
[code][color="blue"]text[/color][/code]It brings back this:
[code]<font color="blue">text</font>[/code]
But, when I submit this:
[code][color="blue"]text[/color][color="blue"]text[/color][/code]It brings back this:
[code]<font color="blue"]stuff[/color][color="blue">stuff</font>[/code]
[b]How can i make it to bring back this?:[/b]
[code]<font color="blue">text</font><font color="blue">text</font>[/code]
I've tried many things, but failed to get what i want...
Changing values and display...
in Javascript Help
Posted