Posted on February 1, 2010, 7:51 am, by admin, under
javascript.
Hi,
From time to time you have a string that contains numbers and letters and you need to split them.
This is very easy to do using Javascript.
Lets say you have this string:
var string = “due_date47″;
to create to vars that one will have “due_date” as value and the other “47″ do this:
<script type=”text/javascript”>var field = “due_date37″;
var [...]
Posted on January 7, 2009, 6:09 pm, by admin, under
javascript.
Well sometime you need that. If you have two submit buttons, one you want to open in the same page and the other on a new one.
Just use this:
document.getElementById(form_id).target= “_blank”;
Hope it helps!
Posted on January 2, 2009, 7:53 am, by admin, under
javascript.
Hi all,
Some time when you use Ajax to do an action you want to give the user an
indication that the action took place and everything went well. For example you have a text field that onchange action calls for a Javascript function that takes the value, sends it to PHP file, [...]
Posted on December 20, 2008, 5:32 pm, by admin, under
javascript.
Hi all,
It took me long time to get it… I wanted to check if a checkbox was checked or not.
So I used:
var checkbox = document.getElementById("checkbox_id").value;
Wrong! Wrong! Wrong!
the right way is:
var checkbox = document.getElementById("checkbox_id").checked;
which return true or false. Minor details wasted me lots of time…
Admin
Posted on March 7, 2008, 3:07 am, by admin, under
javascript.
Hi all,
For beginners this could be helpful – How to get the value of each element in your page using Javascript?
Lets say you have <div id=”newid”></div>
use this:
var element_value = document.getElementById("newid").value;
Hope it helps!