Bluehost.com Web Hosting $6.95

RE: [PHP] JavaScript and PHP

This is a discussion on RE: [PHP] JavaScript and PHP within the PHP General forums, part of the PHP Programming Forums category; On 14 May 2008 21:21, tedd advised: > At 7:31 PM +0100 5/14/08, Mário Gamito ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-16-2008
Ford, Mike
 
Posts: n/a
Default RE: [PHP] JavaScript and PHP

On 14 May 2008 21:21, tedd advised:

> At 7:31 PM +0100 5/14/08, Mário Gamito wrote:
>> Hi,
>>
>> I have this HTML/JS page that switches images
>> clicking on the radio buttons and call
>> template.php with the image ID as parameter:
>> http://portulan-online.net/einstein.html
>>
>> Now, I need to make it a PHP page, because it is
>> going to receive a parameter from the URL that
>> calls it and pass it as is to template.php

>
> Mário:
>
> The key here to remember is that javascript uses
> ID and php uses NAME for inputs.


That's incorrect. A form will function perfectly well with only name= attributes, and no ids, and it's quite possible for JavaScript to address theform elements using only the names (in fact, it's easier than via the ids as there's a short syntax for it!).

CSS and the DOM, however, use the ids as primary identifier, so use of either of those may demand the presence of ids.

Cheers!

Mike

--
Mike Ford, Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
Reply With Quote
  #2 (permalink)  
Old 05-16-2008
Boyd, Todd M.
 
Posts: n/a
Default RE: [PHP] JavaScript and PHP

> -----Original Message-----

8< snip!

> That's incorrect. A form will function perfectly well with only name=
> attributes, and no ids, and it's quite possible for JavaScript to
> address the form elements using only the names (in fact, it's easier
> than via the ids as there's a short syntax for it!).
>
> CSS and the DOM, however, use the ids as primary identifier, so use of
> either of those may demand the presence of ids.


8< snip!

True, you can access an input named "myInput" in a form named "myForm"
by simply writing:

document.myForm.myInput.value = "Hello!";

BUT... for CSS, it's also quite easy to reference something by name:

[name="myElement"]
{
color: blue;
font-size: 10pt;
}


Todd Boyd
Web Programmer
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:26 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0