You are here: Re: [PHP] Problem with Javascript:...submit() « PHP « IT news, forums, messages
Re: [PHP] Problem with Javascript:...submit()

Posted by Jochem Maas on 10/13/05 20:39

Stephen Leaf wrote:
> On Thursday 13 October 2005 01:13 am, Johan Grobler wrote:
>
>>while ($row = mysql_fetch_array($sql_result))
>>{
>>echo"<Form name=\"".$row['LITERATURE_title']."\" action=\"searchlit.php\"
>>method=\"post\"> <font face=\"arial\" size=\"2\">
>><a href=\"javascript:".$row['LITERATURE_title'].".submit();\"
>>
>>>".$row['LITERATURE_title']." - ".$row['res_fname']."
>>
>>".$row['res_lname']."</a> ...
>>
>>Everything works as long as $row['LITERATURE_title'] is one word, see this
>>variable contains the names of books, and if the books name is "Heaven" for
>>instance it works fine but as soon as the title is something like "PHP for
>>Dummies" it doesnt work and i get a error on page message, I tried using
>>numbers as the form name but then the same thing happens.
>
> Another way you can access these is by using this function.

Stephen is being polite - he means the 'correct' way ;-)

>
> document.getElementByName('name');
> or
> document.getElementById('id');
>
> As I recall w3 sees ByName as standard but Mozilla(and many others) only
> support ById, the last time I checked.

<script language="Javascript">
<!--

the value of a name attribute does not need to be unique, where as the value
of the id attribute _MUST_ be unique (according to the specs) ....

document.getElementsByName('name');
^-----------------------notice the 's'

that method returns an array of elements.
out of interest there is also:

document.getElementsByTagName('INPUT');

which also returns an array.

note that these DOM methods will not work in some older browsers, you
may not care but if you do you will probably want to look into
finding a browser compatibility library (some code) that will patch the
problem for you.

//-->
</script>

>
>
>>Any ways around this?
>>
>>thanx
>>--------------------------------------------------------------------
>>Disclaimer
>>This e-mail transmission contains confidential information,
>>which is the property of the sender.
>>The information in this e-mail or attachments thereto is
>>intended for the attention and use only of the addressee.
>>Should you have received this e-mail in error, please delete
>>and destroy it and any attachments thereto immediately.
>>Under no circumstances will the Cape Peninsula University of
>>Technology or the sender of this e-mail be liable to any party for
>>any direct, indirect, special or other consequential damages for any
>>use of this e-mail.
>>For the detailed e-mail disclaimer please refer to
>>http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация