By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,016 Members | 2,297 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,016 IT Pros & Developers. It's quick & easy.

Getting confused while Exploring ORKUT JS code.

dmjpro
100+
P: 2,476
Hi Experts.
I m now days doing test on ORKUT JS code.
I need your help experts.

Now there are multiple forms in a page.
But no actions are there.

Now when the page is submitted then this function called.

Expand|Select|Wrap|Line Numbers
  1. function ti_Y(a,b,c)
  2. {
  3.     if(eval(c)!=false)
  4.     {
  5.         var d=ti_H(a);
  6.         if(d!=null){
  7.         var e=document.createElement("input");
  8.         e.setAttribute("type","submit");
  9.         if(b!=null&&b.length>0){e.setAttribute("name","Action."+b)}
  10.         e.setAttribute("style","display: none;");
  11.         d.appendChild(e);
  12.         try{e.click()}catch(f){}
  13.         try{d.removeChild(e)}catch(f){e.parentNode.removeChild(e)}
  14.         }
  15.     }
  16. }
  17.  
Now you can understand the particular form is submitted but here no action attribute set.
So could you help me to find out the target page.
And one thing please clarify me that e.setAttribute("name","Action."+b).
What is it's significance?
Actually is it valid <input type=button name="a.b">?
Any dot in name atribute?

Please help experts.
I need it urgent.

Kind regards,
Dmjpro.
Aug 23 '07 #1
Share this Question
Share on Google+
7 Replies


acoder
Expert Mod 15k+
P: 16,027
What are a, b and c? Give an example.

In line 5, a function call is made to ti_H. Show the code for that.
Aug 23 '07 #2

dmjpro
100+
P: 2,476
What are a, b and c? Give an example.

In line 5, a function call is made to ti_H. Show the code for that.

Thanks for your reply.

Expand|Select|Wrap|Line Numbers
  1. function ti_H(a){
  2.     var b=a.tagName.toLowerCase();
  3.     while(b!="form"&&b!="body"){b=a.parentNode.tagName.toLowerCase();a=a.parentNode}
  4.     return b=="form"?a:null
  5. }
  6.  
and the call is ............

_submitForm(form, 'submit', '');

and in JS file this._submitForm=ti_Y

Please help me.

Kind regards,
Dmjpro.
Aug 23 '07 #3

pbmods
Expert 5K+
P: 5,821
Heya, Dmjpro.

Setting the name of a submit button is useful when you have more than one submit button in a form.

For example, if you had a shopping cart, and you wanted to use one button to update your cart, and a second button to update and start the checkout process:
Expand|Select|Wrap|Line Numbers
  1. <input name="update" type="submit" value="Update Cart" />
  2. <input name="checkout" type="submit" value="Update &amp; Checkout" />
  3.  
When you submit the form, an additional variable will be created with the name of the button you clicked. So for example, if the User clicked on the 'Update Cart' button, the form action will receive update=1 along with the other form variables.
Aug 23 '07 #4

dmjpro
100+
P: 2,476
Heya, Dmjpro.

Setting the name of a submit button is useful when you have more than one submit button in a form.

For example, if you had a shopping cart, and you wanted to use one button to update your cart, and a second button to update and start the checkout process:
Expand|Select|Wrap|Line Numbers
  1. <input name="update" type="submit" value="Update Cart" />
  2. <input name="checkout" type="submit" value="Update &amp; Checkout" />
  3.  
When you submit the form, an additional variable will be created with the name of the button you clicked. So for example, if the User clicked on the 'Update Cart' button, the form action will receive update=1 along with the other form variables.
Thanks for your reply.
But those submit button r in different form.
And my question is that without any action how can I submit a page.
And if the action is not specified then what will be action.

Please help me.

Kind regards,
Dmjpro.
Aug 24 '07 #5

acoder
Expert Mod 15k+
P: 16,027
And if the action is not specified then what will be action.
If it is submitting to a page, it must be set somewhere. Whilst submitting (onsubmit), check the form's action property.
Aug 24 '07 #6

dmjpro
100+
P: 2,476
If it is submitting to a page, it must be set somewhere. Whilst submitting (onsubmit), check the form's action property.

Acoder thanks for your suggestion.
But friend this is Google.
Actually they have not set directly the action property.
Ok I will find out the onsubmit function is there any.
Thanks a lot Acoder.
It may help me to do that.

Kind regards,
Dmjpro.
Aug 24 '07 #7

pbmods
Expert 5K+
P: 5,821
Heya, Dmjpro.

You can set the action to whatever you want by setting {formReference}.action in your JavaScript.
Aug 24 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.