Only 5 byte and you can find out if it`s IE
Example:
if(-[1,]){
alert(“Not IE!”);
}
Source: http://habrahabr.ru/blogs/javascript/80333 it`s in russian but still you can use google translate
Only 5 byte and you can find out if it`s IE
Example:
if(-[1,]){
alert(“Not IE!”);
}
Source: http://habrahabr.ru/blogs/javascript/80333 it`s in russian but still you can use google translate
In one of project I use MIDI object to play midi files. Everything work perfect in IE7, until I test it on IE6. After couple of seconds that I stop midi IE6 crash with some strange error.
So after my research I found that when you try to delete MIDI object after that you stop him by default midi control IE6 crash. By the way sometimes it takes a while untils this error will apear and it`s probably depend on ie6 version.
Tested with: audio/x-midi, audio/midi withoud classid with same result
IE6 version: 6.0.2900.2180.xpsp_sp2_gdr.070227-2254
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Midi/Object Test Page</title>
<script>
function stopMusic()
{
var music = document.getElementById('testme');
music.stop();
document.getElementById('testme2').innerHTML = "123";
}
</script>
</head>
<body>
<div id="testme2">
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="testme">
<param name="autostart" value="true">
<param name="FileName" value="1730199.mid">
</object>
</div>
<input type="button" onclick="stopMusic()" value="test me" />
</body>
</html>
In one of the projects I am faced with problem of the java scripts execution on different domains.
After advice from one of team leaders, the solution was found and it was a quite simple.
For example, we have A domain with frame that point to domain B which is to call javascript function in domain A.
If you simply call a window.parent.funcame you will get exception. So what can we do ?
It is very simple – in domain B we create frame to domain A and then we try to execute a function on domain A as window.parent.parent.fucname and how we can see function is executed succesufully.
So this script does this operation automatically without requiring knowledge of java script.
Credits: Nir Levy
Usage:
Domain A:
Main file:
<html>
<head><title>domain_a</title></head>
<body>
<script>
function showmelove(text)
{
alert(text);
}
</script>
... some content here ...
<iframe id="hpel" height="100" frameborder="0" width="100%" scrolling="0" title="" src="http://domain_b/iframe.html" style="height: 194px;"></iframe>
... some content here ...
</body>
</html>
* This source code was highlighted with Source Code Highlighter.
Exec file:
<html>
<body>
<script type="text/javascript" src="crossdomain_server.js"></script>
<script type="text/javascript">
crossdomain.server().init();
</script>
</body>
</html>
* This source code was highlighted with Source Code Highlighter.
Domain B:
<html>
<head>
<script src="crossdomain_client.js" type="text/javascript" ></script>
<script>
crossdomain.client("frame").init("http://www.domain_a/iframe.html");
function sendText() {
crossdomain.client("frame").callfunc("showmelove",{mesasge: "'hello world'"});
}
</script>
</head>
<body>
<div id="allBodyDiv">
some content goes here...
<input type="button" value="send" onclick="sendText()" />
</div>
</body>
</html>
* This source code was highlighted with Source Code Highlighter.
Download: CrossDomain
Today I worked with two elements with same ids but in different forms, and found strange jquery selector engine behavior. Actually I can undrestand that, because by w3c you cant place two elements with same ids on same page.
Description: Two froms with element with same id in both of them, trying to use jquery selector to choose one of them like this $(“#formid #elemid”). Result will be null.
Example:
HTML:
<form id="form1" method="post" action="/">
<input type="text" class="inputtext" id="text1" name="text1" value=""/>
<input type="text" class="inputtext" id="text2" name="text2" value=""/>
<input type="text" class="button" id="btn1" value="press me"/>
</form><form id=”form2″ method=”post” action=”/”>
<input type=”text” class=”inputtext” id=”text1″ name=”text1″ value=””/>
<input type=”text” class=”inputtext” id=”text2″ name=”text3″ value=””/>
<input type=”text” class=”button” id=”btn2″ value=”press me2″/>
</form>
* This source code was highlighted with Source Code Highlighter.
Javascript:
$('#btn1').click(function() {
if (!$('#form1 #text1').val()) {
$('#form1 #text1').css('border','1px solid red');
}
if (!$('#form1 #text2').val()) {
$('#form1 #text2').css('border','1px solid red');
}
});$(‘#btn2’).click(function() {
if (!$(‘#form2 #text1’).val()) {
$(‘#form2 #text1’).css(‘border’,‘1px solid red’);
}
if (!$(‘#form2 #text2’).val()) {
$(‘#form2 #text4’).css(‘border’,‘1px solid red’);
}
});* This source code was highlighted with Source Code Highlighter.
fcbkListSelection – fancy item selector (like facebook friends selector) with wide range of options.
If you have any comments or requests, please post them and I will try to include all the requested features in the upcoming release.
HowTo:
1) HTML stracture:
<ul id="ulid">
<li>regular content <input type="hidden" value="value" /></li>
<li>preselected content <input type="hidden" value="value" checked="checked" /></li>
<li>regular content <input type="hidden" value="value" /></li>
</ul>* This source code was highlighted with Source Code Highlighter.
2) Javascript:
<script type="text/javascript" language="JavaScript">
$(document).ready(function() {
//id(ul id),width,height(element height),row(elements in row)
$.fcbkListSelection(id[ul id],width,height[element height],row[elements in row]);
});
</script>* This source code was highlighted with Source Code Highlighter.
Changelog:
– 1.1: added preselected items
– 1.0: project started
Download: Download fcbkListSelection
Demo: Demo fcbkListSelection
Storeit – new way to share you images.
Status: Beta
Language: Hebrew/English/Russian (Russian & English in development)
Description: The easy way to share you image with your friends.