hi
I use below code for change dropdownlist appearnce:
<script src="scripts/jquery.selectric.min.js"></script>
<link href="Css/selectricO.css" rel="stylesheet" />
<script type="text/javascript">
window.onload = function () {
ApplyCss();
};
function ApplyCss() {
$('select').selectric({
maxHeight: 200
});
};
//On PostBack
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
ApplyCss();
}
});
};
</script>
and use below code for watermark:
<script type="text/javascript">
window.onload = function SetColorOnPageLoad() {
var defalutAzText = "از";
var defalutTaText = "تا";
var defalutsearch = "جستجو بر اساس کد ملک";
functionSetColor(document.getElementById("Txtsearch"), defalutsearch);
functionSetColor(document.getElementById("Txtejare1"), defalutAzText);
functionSetColor(document.getElementById("Txtejare2"), defalutTaText);
functionSetColor(document.getElementById("txtvadi1"), defalutAzText);
functionSetColor(document.getElementById("txtvadi2"), defalutTaText);
}
function functionSetColor(Textbox, WaterMark) {
if (Textbox.value.length > 0 && Textbox.value == WaterMark) {
Textbox.style.color = "#443f13";
Textbox.style.fontSize = "14.5px";
txt.style.fontfamily = "behtop_Yekan";
} else {
Textbox.style.color = "white";
Textbox.style.fontSize = "14.5px";
txt.style.fontfamily = "behtop_Yekan";
}
}
function WaterMark(txt, evt, msg) {
if (txt.value.length == 0 && evt.type == "blur") {
txt.style.color = "#443f13";
txt.value = msg;
txt.style.fontSize = "14.5px";
txt.style.fontfamily = "behtop_Yekan";
}
if (txt.value == msg && evt.type == "focus") {
txt.style.color = "white";
txt.value = "";
if (txt.name == "Txtsearch") {
txt.style.fontSize = "25px";
}
else {
txt.style.fontSize = "14.5px";
}
txt.style.fontfamily = "behtop_Yekan";
}
}
</script>
problem is that when I use these code together one of them doesn't work see if at first I use script for dropdown list like below:
<script type="text/javascript">
window.onload = function () {
ApplyCss();
};
function ApplyCss() {
$('select').selectric({
maxHeight: 200
});
};
//On PostBack
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
ApplyCss();
}
});
};
</script>
<script type="text/javascript">
window.onload = function SetColorOnPageLoad() {
var defalutAzText = "از";
var defalutTaText = "تا";
var defalutsearch = "جستجو بر اساس کد ملک";
functionSetColor(document.getElementById("Txtsearch"), defalutsearch);
functionSetColor(document.getElementById("Txtejare1"), defalutAzText);
functionSetColor(document.getElementById("Txtejare2"), defalutTaText);
functionSetColor(document.getElementById("txtvadi1"), defalutAzText);
functionSetColor(document.getElementById("txtvadi2"), defalutTaText);
}
function functionSetColor(Textbox, WaterMark) {
if (Textbox.value.length > 0 && Textbox.value == WaterMark) {
Textbox.style.color = "#443f13";
Textbox.style.fontSize = "14.5px";
txt.style.fontfamily = "behtop_Yekan";
} else {
Textbox.style.color = "white";
Textbox.style.fontSize = "14.5px";
txt.style.fontfamily = "behtop_Yekan";
}
}
function WaterMark(txt, evt, msg) {
if (txt.value.length == 0 && evt.type == "blur") {
txt.style.color = "#443f13";
txt.value = msg;
txt.style.fontSize = "14.5px";
txt.style.fontfamily = "behtop_Yekan";
}
if (txt.value == msg && evt.type == "focus") {
txt.style.color = "white";
txt.value = "";
if (txt.name == "Txtsearch") {
txt.style.fontSize = "25px";
}
else {
txt.style.fontSize = "14.5px";
}
txt.style.fontfamily = "behtop_Yekan";
}
}
</script>
script for dropdownlist doesn't work but water mark worked correctly
but when I use watermark codes at first and then use script for dropdownlist like below:
<script type="text/javascript">
window.onload = function SetColorOnPageLoad() {
var defalutAzText = "از";
var defalutTaText = "تا";
var defalutsearch = "جستجو بر اساس کد ملک";
functionSetColor(document.getElementById("Txtsearch"), defalutsearch);
functionSetColor(document.getElementById("Txtejare1"), defalutAzText);
functionSetColor(document.getElementById("Txtejare2"), defalutTaText);
functionSetColor(document.getElementById("txtvadi1"), defalutAzText);
functionSetColor(document.getElementById("txtvadi2"), defalutTaText);
}
function functionSetColor(Textbox, WaterMark) {
if (Textbox.value.length > 0 && Textbox.value == WaterMark) {
Textbox.style.color = "#443f13";
Textbox.style.fontSize = "14.5px";
txt.style.fontfamily = "behtop_Yekan";
} else {
Textbox.style.color = "white";
Textbox.style.fontSize = "14.5px";
txt.style.fontfamily = "behtop_Yekan";
}
}
function WaterMark(txt, evt, msg) {
if (txt.value.length == 0 && evt.type == "blur") {
txt.style.color = "#443f13";
txt.value = msg;
txt.style.fontSize = "14.5px";
txt.style.fontfamily = "behtop_Yekan";
}
if (txt.value == msg && evt.type == "focus") {
txt.style.color = "white";
txt.value = "";
if (txt.name == "Txtsearch") {
txt.style.fontSize = "25px";
}
else {
txt.style.fontSize = "14.5px";
}
txt.style.fontfamily = "behtop_Yekan";
}
}
</script>
<script type="text/javascript">
window.onload = function () {
ApplyCss();
};
function ApplyCss() {
$('select').selectric({
maxHeight: 200
});
};
//On PostBack
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
ApplyCss();
}
});
};
</script>
here watermark doesn't work but dropdown script worked correctly
how I can use these codes together?
best regards
neda