Friday, 27 April 2012

Some basic java script

Hi Guys ,

Some basic java script

1) Take a text item

2)Put HTML items on both left and right of it

3) Start <div > tag on left and end on right HTML

4)Put the code in the left HTML

5)Note -Always try to write small pieces of code in java save them in notepad and then use this as parts later .Its difficult to track errors can be something very small .This will save you a lot of time.

<script language="javascript" type="text/javascript">
function f_aler()
{
  alert("this is a function call");
}
</script>
<div id="btn1"  onclick="f_aler();" >
<p>"this is text to click" </p>
</div>

Below is some script that will allow you to click on column title and assign value to prompt.Can be helpful for dynamic column sorting

<script language="javascript" type="text/javascript">
function f_aler(id)
{
  alert(id) ;
var form = getFormWarpRequest();
       var textB  = form._textEditBoxABC;
       textB.value = "Hello";
}
</script>
<div id="btn1"  onclick="f_aler(id);" >
</div>

For below code you require two text box prompts .For one of the prompt set the default value to asc

<script language="javascript" type="text/javascript">
function f_aler(id)
{
  alert(id) ;
var form = getFormWarpRequest();
       var textB  = form._textEditBoxABC;
       textB.value = "Hello";
       var textc  = form._textEditBoxascsel;
        if (textc.value =="asc")
       {
           textc.value ="dsc"; 
        }
      else
      {
         textc.value ="asc";
       }      
  
}
</script>
<div id="btn1"  onclick="f_aler(id);" >
</div>

No comments:

Post a Comment