Category: Javascript

Bangla Virtual Keyboard Scripts for Web Pages is released

Lastly I completed the bengali virtual keyboard (both popup and inline) for web page. Ekushey.org released these scripts.

News from ekushey site:

Bangla Virtual Keyboard Scripts for Web Pages is released. Sabuj Kundu did an excillent job by making this release. Now people who don’t know any keyboard layout for typing Bangla can write Bangla on Web pages. Somewhereinblog, Amader Projukti forum is using this kind of Bangla input system. Now anyone can use these scripts and let user input with Bangla on their web pages.

Both scripts are available here.

BTW, I am working to integrate bangla writing scripts like phonetic,unijoy and probhat to tinyMCE. For this I have already developed a plugin . It’s like a popup virtual keyboard and have opportunity to insert text by from it with fixed keyboard options. Now I am trying to do it directly.

Thank you.

Dynamic change of link text using java script

Today I was doing some works on java script and html to make a inline virtual keyboard. But I was searching google for a script that can change the link text that means anchor tag’s text dynamically. Opps..I took more that 2 hour to solve it and make it cross browser compatible. So here I want to share the code that I used in my works and the links that helps me.

Suppose you want make  something for each click in a link it’s text will be toggled.

like:

<a href=”url here”>Show</a>

<a href=”url here”>Hide</a>

<a href=”url here”>Show</a>

<a href=”url here”>hide</a>  ….

Let’s here is the code :

<a href=”#” onclick=”showhide();”  id=”linkid”>Show</a>
<script language=”javascript”>

var link = document.getElementById(‘linkid’);
function showhide()
{
if (document.all)
{ //IS IE 4 or 5 or later
if(link.innerText==’Show’)
{
link.innerText=’Hide’;
}
else
{
link.innerText=’Show’;
}
}
//IS NETSCAPE 4 or below
if (document.layers)
{
if(link.innerText==’Show’)
{
link.innerText=’Hide’;
}
else
{
link.innerText=’Show’;
}
//alert(“NETSCAPE 4 or below”);
}
//Mozilla/Netscape6+ and all the other Gecko-based browsers
if (document.getElementById &&!document.all)
{
if(link.firstChild.nodeValue==’Show’)
{
link.firstChild.nodeValue=’Hide’;
}
else
{
link.firstChild.nodeValue=’Show’;
}
//alert(link.firstChild.nodeValue);
//alert(” by id and not all”);

}
}
</script>
This code is compatible with most known browsers..:D

Another way:

function toggleshowhide()
{
var anchors = document.getElementsByTagName(“a”);
for(var i = 0; i < anchors.length; ++i)
{
if(anchors[i].firstChild.data == “Show”)
{
anchors[i].replaceChild(document.createTextNode(“Hide”),
anchors[i].firstChild);
}
else if(anchors[i].firstChild.data == “Hide”)
{
anchors[i].replaceChild(document.createTextNode(“Show”),
anchors[i].firstChild);
}
}
}

java script: window.open function problem in IE

For some days, I am trying to make a popup virtual keyboard for bengali characters for my forum amaderprojukti.com. The problem that I faced and waste so many hours is that it was working in firefox, opera, safari, netscape etc except in IE(Internet explorer).

To make a popup window I used java script some thing like

window.open(‘url to popup’, ‘popup window name’, ‘other parameter’);

Any one can get some help from this link.

The problem I faced that I used the window name with spaces like ‘my window’. It works fine in ‘firefox like browser’ except in IE. When I used the window name ‘mywindow’ (see know space in window name), the code worked in IE too.

I don’t like internet explorer  at all..

Note: I am novice in java script…. :(.