Category Archives: Javascript

Jquery Fancy Box – Issue in IE – How to fix?

I used jquery fancy box for displaying the contact box in the ocean dental web site and when I tested it using chrome, safari and firefox it was working without any issue. But when I tested using IE 7/ 8 it was not showing up properly. the fancy box has become smaller than the content on the page.

After trying to fix the issue by trying various css tricks and editing the stylesheets used by fancy box.

I found that the page that I am calling fancy box must have a specific doc type. after applying what is given in fancy box site it started working without any issue. If your like me and if you have just integrated fancy box by copieng from the demo you might also get this error, so to fix this use the following doc type on the page that your calling fancy box.

<code>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml&#8221; xml:lang=”en” lang=”en”>

</code>

 

Hope this will help. 🙂

Advertisements

How to Change All textbox or textfield values to upper case using javascript

I was searching for a method to get all the text boxes and text field data in a web page and change the values to upper case using java script, but couldn’t find a good script.

So I decided to write my own script. You can change this to fit your needs. This will be useful to format the form inputs automatically.


//function to check and change all text field values to upper case
function changeAllToUpper(){

var inputs = document.getElementsByTagName(‘input’);    // get all the text boxes
for(var k=0;k<inputs.length;k++)
{
var input = inputs[k]
if(input.type!= ‘text’) continue;
input.value=input.value.toUpperCase();  // make values uppercase
}

var textboxes = document.getElementsByTagName(‘textarea’);  // get all the text areas

for(var l=0;l<textboxes.length;l++)
{
var textbox = textboxes[l]

textbox.value=textbox.value.toUpperCase(); // make values upper case
}

}

you can call this function when clicking the form submit button like this,


onclick="javascript:changeAllToUpper();"

Some Suggestions

  • you can do any text modification using this script before submitting. (make lower case, camel case, or you can even use this for validate and update the data)
  • remove any unwanted symbols or characters easily without any server load.

Hope this code will be useful to you. let me know what you think. 🙂