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

"Missing name after . operator "

P: 7
Expand|Select|Wrap|Line Numbers
  1. <form name="return" method="post" action="a.jsp">
  2.             <input type="hidden" name="name" value="bb">
  3.  
  4.         </form>
  5.         <script language="JavaScript" type="text/javascript">
  6.             document.return.submit();
  7.         </script>

The code makes an auto-submit form.
In Firefox is working, but in Internet Explorer, it doesn't make the redirect thing.

In Netbeans I receive the message "Missing name after . operator "

What is the problem?
Aug 12 '09 #1
Share this Question
Share on Google+
8 Replies


gits
Expert Mod 5K+
P: 5,390
return is a keyword ... you shouldn't use it .... change it to 'returnForm' or similar
Aug 12 '09 #2

P: 7
So instead of
Expand|Select|Wrap|Line Numbers
  1. <form name="return"
  2. document.return.submit();
I should use

Expand|Select|Wrap|Line Numbers
  1. <form name="blabla"
  2. document.blabla.submit();

Is not working. :(
Aug 12 '09 #3

Markus
Expert 5K+
P: 6,050
Try this (using document.getElementById())

Expand|Select|Wrap|Line Numbers
  1. <form id="returnForm" method="post" action="a.jsp">
  2.             <input type="hidden" name="name" value="bb">
  3.  
  4.         </form>
  5.         <script language="JavaScript" type="text/javascript">
  6.             document.getElementById('returnForm').submit();
  7.         </script>
  8.  
Aug 12 '09 #4

P: 7
Now is not working in Firefox, but in Internet Explorer is working. HAHAHA
Aug 12 '09 #5

gits
Expert Mod 5K+
P: 5,390
what about using the 'returnForm' as name attrib again and then:

Expand|Select|Wrap|Line Numbers
  1. document.forms['returnForm'].submit();
Aug 13 '09 #6

LAT78
P: 2
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(!function_exists('BrowserDetection')){
  3.     function BrowserDetection($which_test){
  4.         $browser='';
  5.         $dom_browser='';
  6.         $navigator_user_agent=(isset($_SERVER['HTTP_USER_AGENT'])) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
  7.         if(stristr($navigator_user_agent,"opera")){
  8.             $browser='opera';
  9.             $dom_browser=true;
  10.         }elseif(stristr($navigator_user_agent,"msie 4")){
  11.             $browser='msie4';
  12.             $dom_browser=false;
  13.         }elseif(stristr($navigator_user_agent,"msie")){
  14.             $browser='msie';
  15.             $dom_browser=true;
  16.         }elseif((stristr($navigator_user_agent,"konqueror")) || (stristr($navigator_user_agent, "safari"))){
  17.             $browser='safari';
  18.             $dom_browser=true;
  19.         }elseif(stristr($navigator_user_agent,"gecko")){
  20.             $browser='mozilla';
  21.             $dom_browser=true;
  22.         }elseif(stristr($navigator_user_agent,"mozilla/4")){
  23.             $browser='ns4';
  24.             $dom_browser=false;
  25.         }else{
  26.             $dom_browser=false;
  27.             $browser=false;
  28.         }
  29.         if($which_test=='browser'){
  30.             return $browser;
  31.         }elseif($which_test=='dom'){
  32.             return $dom_browser;
  33.         }
  34.     }
  35. }?>
  36. <form name="SecretForm" method="post" action="a.jsp">
  37.   <input type="hidden" name="name" value="bb">
  38.   <input type="submit" value="submit">
  39. </form><?
  40. if(browserdetection('browser')=="msie"){?>
  41. <script language="JavaScript" type="text/javascript"><!--
  42.     document.forms('SecretForm').submit()
  43. //--></script><?
  44. }elseif(BrowserDetection('browser')=="mozilla"){?>
  45. <script language="JavaScript" type="text/javascript"><!--
  46.     document.SecretForm.submit();
  47. //--></script><?
  48. }
Jul 31 '10 #7

gits
Expert Mod 5K+
P: 5,390
should that be useful for a form auto-submit? ... as Markus suggested by just giving the form an id and then using:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('formId').submit();
everything should work without any browser-detection. another option would be the reference in post #6. for a form submit no browser detection should be needed.
Jul 31 '10 #8

LAT78
P: 2
yes but it doest work one my site and i have to use browser for the user not have to see a blank site with a submit button.
Aug 12 '10 #9

Post your reply

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