function fix_flash() {
var embeds = document.getElementsByTagName('embed');
for(i=0; i<embeds.length; i++) {
embed = embeds[i];
var new_embed;
if(embed.outerHTML) {
var html = embed.outerHTML;
if(html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i))
new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i,"wmode='transparent'");
else
new_embed = html.replace(/<embed\s/i,"<embed wmode='transparent' ");
embed.insertAdjacentHTML('beforeBegin',new_embed);
embed.parentNode.removeChild(embed);
} else {
new_embed = embed.cloneNode(true);
if(!new_embed.getAttribute('wmode') || new_embed.getAttribute('wmode').toLowerCase()=='window')
new_embed.setAttribute('wmode','transparent');
embed.parentNode.replaceChild(new_embed,embed);
}
}
var objects = document.getElementsByTagName('object');
for(i=0; i<objects.length; i++) {
object = objects[i];
var new_object;
if(object.outerHTML) {
var html = object.outerHTML;
if(html.match(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i))
new_object = html.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i,"<param name='wmode' value='transparent' />");
else
new_object = html.replace(/<\/object\>/i,"<param name='wmode' value='transparent' />\n</object>");
var children = object.childNodes;
for(j=0; j<children.length; j++) {
if(children[j].getAttribute('name').match(/flashvars/i)) {
new_object = new_object.replace(/<param\s+name\s*=\s*('|")flashvars('|")\s+value\s*=\s*('|")[^'"]*('|")\s*\/?\>/i,"<param name='flashvars' value='"+children[j].getAttribute('value')+"' />");
}
}
object.insertAdjacentHTML('beforeBegin',new_object);
object.parentNode.removeChild(object);
}
}
}
$(document).ready(function () {
fix_flash();
});
http://www.developersnippets.com/2010/12/04/how-to-add-wmodetransparent-for-flash-object-using-jquery-and-native-javascript/
http://www.onlineaspect.com/2009/08/13/javascript_to_fix_wmode_parameters/
Z-index для flash-элементов
$("embed").attr("wmode", "opaque");
$(document).ready(function() {
var embedTag;
$("embed").each(function(i) {
embedTag = $(this).attr("outerHTML");
if ((embedTag != null) && (embedTag.length > 0)) {
embedTag = embedTag.replace(/embed /gi, "embed wmode=\"opaque\" ");
$(this).attr("outerHTML", embedTag);
}
});
});
http://labs.kaliko.com/2009/11/change-wmode-with-jquery.html
Не работает в IE
Если нужен автофокус по id:
function FieldAutoFocus() {
document.getElementById('fieldid').focus();
}
window.onload=FieldAutoFocus;
Автофокус в первый input:
function FirstInputFocus() {
document.getElementsByTagName('input')[0].focus();
}
window.onload=FirstInputFocus;
Усложняем. Если более 4 input на странице, то автофокус в 4-й (нумерация с 0), иначе в первый:
function InContentFormFocus() {
if (document.getElementsByTagName('input')[4]!=undefined) {
document.getElementsByTagName('input')[3].focus();
}
else {
document.getElementsByTagName('input')[0].focus();
}
}
window.onload=InContentFormFocus;
Чего-то там поменялось)) Можно указать конечное значение. И сообщает о завершении алертом.
<html>
<head>
<style type="text/css">
* {
margin: 10px;
}
body {
color: #505050;
font-size: 22px;
}
input {
border: 1px solid #ccc;
color: #505050;
font-size: 22px;
}
iframe {
border: 10px solid #3e6093;
}
label:hover {
text-decoration: underline;
}
#go {
color: #4fad51;
}
#br {
color: #e03c42;
}
</style>
</head>
<body>
<iframe id="edboframe" width="1100px" border="1" height="400px" src=""></iframe><br/>
<label for="lid">Start with:</label> <input type="text" id="lid" value="1" />
<label for="endid">Stop at:</label> <input type="text" id="endid" value="1" />
<label for="timer">Interval:</label> <input type="text" id="timer" value="3" /><br/>
<input type="button" id="go" value="Start" onclick="StartScript();" />
<input type="button" id="br" value="Stop" onclick="StopScript();" /><br/>
<script type="text/javascript">
function StartScript() {
var ed=document.getElementById('edboframe');
var id=document.getElementById('lid');
var to=document.getElementById('timer');
var end=document.getElementById('endid');
var next=(id.value*1)+1;
if (next<=end.value) {
ed.src='http://10.61.9.15/lists_abiturients/?id='+next+'&action=edboup';
id.value=next;
setTimeout(StartScript,to.value*1000);
}
else {
alert('Successfully completed');
}
}
function StopScript() {
var to=document.getElementById('timer');
to.value=9999;
}
</script>
</body>
</html>
Теперь можно задать интервал, начальное значение, остановить, ну да и красивенько)))
<html>
<head>
<style type="text/css">
* {
margin: 10px;
}
body {
color: #505050;
font-size: 22px;
}
input {
border: 1px solid #ccc;
color: #505050;
font-size: 22px;
}
iframe {
border: 10px solid #3e6093;
}
label:hover {
text-decoration: underline;
}
#go {
color: #4fad51;
}
#br {
color: #e03c42;
}
</style>
</head>
<body>
<iframe id="edboframe" width="1000px" border="1" height="400px" src=""></iframe><br/>
<label for="lid">Start with:</label> <input type="text" id="lid" value="1" />
<label for="timer">Interval:</label> <input type="text" id="timer" value="3" /><br/>
<input type="button" id="go" value="Start" onclick="StartScript();" />
<input type="button" id="br" value="Stop" onclick="StopScript();" /><br/>
<script type="text/javascript">
function StartScript() {
var ed=document.getElementById('edboframe');
var id=document.getElementById('lid');
var to=document.getElementById('timer');
var next=(id.value*1)+1;
ed.src='http://10.61.9.15/lists_abiturients/?id='+next+'&action=edboup';
id.value=next;
setTimeout(StartScript,to.value*1000);
}
function StopScript() {
var to=document.getElementById('timer');
to.value=9999;
}
</script>
</body>
</html>
Скрипт каждые 2 секунды открывает во фрейме ссылку с разным ID. Изменить отсчет можно пр помощи ручного вписывания ID в тектовое поле. Остановить выполнене — закрытием окна, большей функциональности не требовалось.
<html>
<body>
<iframe id="edboframe" width="1000px" border="1" height="400px" src=""></iframe><br/>
<input type="text" id="lid" value="" /><br/>
<script type="text/javascript">
function ChangeLink() {
var ed=document.getElementById('edboframe');
var id=document.getElementById('lid');
var next=(id.value*1)+1;
ed.src='http://10.61.9.15/lists_abiturients/?id='+next+'&action=edboup';
id.value=next;
setTimeout(ChangeLink,2000);
}
ChangeLink();
</script>
</body>
</html>
Нужно для корректного отображения суммы.
Т.е. из 144283.00 должно получиться 144,283.00
PHP. Все просто:
number_format($value,2,'.',',');
Javascript:
function moneyFormat(n) {
var s = String(n);
var k = s.indexOf('.');
if (k < 0) {
k = s.length;
s += '.00';
}
else {
s += '00';
}
s = s.substr(0, k + 3);
for (var i = k - 3, j = n < 0 ? 1 : 0; i > j; i -= 3) s = s.substr(0, i) + ',' + s.substr(i);
return s;
}
Разные варианты на javascript: http://www.weblancer.net/forum/themes/2655.html