Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   XHTML Strict and Script (http://www.velocityreviews.com/forums/t155783-xhtml-strict-and-script.html)

Tom 11-15-2003 04:09 AM

XHTML Strict and Script
 
Hi,

XHTML depreciates "name" and "target" for FORM. Most javascripts that
interact with FORM make heavy use of "name" to know which form to interact
with. You can use ID to 'name' a form, but javascript does not recognize
"id".

I have not been able to find any discussions of how to get around these
obstacles. Does anyone have any websites to review or suggestions?

Tom



Leif K-Brooks 11-15-2003 04:22 AM

Re: XHTML Strict and Script
 
Tom wrote:

> You can use ID to 'name' a form, but javascript does not recognize "id".


Yes it does, document.getElementById().

Tom 11-15-2003 05:18 AM

Re: XHTML Strict and Script
 
"Leif K-Brooks" <eurleif@ecritters.biz> wrote in message
news:lShtb.854$Re.841046@newshog.newsread.com...
> Tom wrote:
>
> > You can use ID to 'name' a form, but javascript does not recognize "id".

>
> Yes it does, document.getElementById().


OK, here is the code:

<form id="form3" action="url">
<select name="pblinks" size="1">
<option selected value="#">Select the size...</option>
<option value="url">1.0 L - $19.90</option>
<option value="url">1.5 L - $29.85</option>
<option value="url">2.0 L - $39.80</option>
<option value="url">3.0 L - $59.70</option>
</select><br />
<input id="button" type="button" value="Buy Now"
onclick="window.open(document.getelementbyid().pbl inks.options[document.gete
lementbyid().pblinks.selectedIndex].value);" />
</form>

Is this the proper use of the getelementbyid()?

Thanks for the help...Tom



Vjekoslav Begovic 11-15-2003 07:46 AM

Re: XHTML Strict and Script
 
"Tom" <sail_saba@cox.net> wrote:

> <input id="button" type="button" value="Buy Now"
>

onclick="window.open(document.getelementbyid().pbl inks.options[document.gete
> lementbyid().pblinks.selectedIndex].value);" />
> </form>
>
> Is this the proper use of the getelementbyid()?


No, use:

document.getElementById('pblinks').

Also, notice that JavaScript is case-sensitive.



Kris 11-15-2003 10:37 AM

Re: XHTML Strict and Script
 
In article <xHitb.10726$Q64.5650@fed1read03>, "Tom" <sail_saba@cox.net>
wrote:

> <form id="form3" action="url">
> <select name="pblinks" size="1">
> <option selected value="#">Select the size...</option>
> <option value="url">1.0 L - $19.90</option>
> <option value="url">1.5 L - $29.85</option>
> <option value="url">2.0 L - $39.80</option>
> <option value="url">3.0 L - $59.70</option>
> </select><br />
> <input id="button" type="button" value="Buy Now"
> onclick="window.open(document.getelementbyid().pbl inks.options[document.gete
> lementbyid().pblinks.selectedIndex].value);" />
> </form>
>
> Is this the proper use of the getelementbyid()?


This is improper use of javascript. The form will not work without it
and that is totally unneccesary.

<form action="serverSideHandler.php" method="post"
onsubmit="if(document.getElementById) {
window.open(document.getElementById('pblinks').sel ectedIndex.value);
return false; }">
<select name="pblinks" id="pblinks" size="1">
<option selected>Select the size...</option>
<option value="http://www.textarea51.com/1">1.0 L - $19.90</option>
<option value="http://www.textarea51.com/2">1.5 L - $29.85</option>
<option value="http://www.textarea51.com/3">2.0 L - $39.80</option>
<option value="http://www.textarea51.com/4">3.0 L - $59.70</option>
</select><br />
<input type="submit" value="Buy Now" />
</form>

serverSideHandler.php:
<?
if($pblinks) {
header("Location: ".$pblinks);
} else header("Location: ".$HTTP_REFERER);
?>

Something like this. I may have screwed up in one place or the other,
since I did not test this.

--
Kris
kristiaan@xs4all.netherlands (nl)

Bertilo Wennergren 11-15-2003 12:32 PM

Re: XHTML Strict and Script
 
Tom:

> XHTML depreciates "name" and "target" for FORM. Most javascripts that
> interact with FORM make heavy use of "name" to know which form to interact
> with. You can use ID to 'name' a form, but javascript does not recognize
> "id".


Of course Javascript recognizes "id".

> I have not been able to find any discussions of how to get around these
> obstacles.


In XHTML 1.0 Transitional you can use both "name" and "target" in forms.
The same goes for HTML 4.01 Transitional.

"Target" is missing for forms in HTML 4.01 Strict, as well as in XHTML
1.0 Strict.

--
Bertilo Wennergren <bertilow@gmx.net> <http://www.bertilow.com>


Woolly Mittens 11-15-2003 07:12 PM

Re: XHTML Strict and Script
 
>"Tom" <sail_saba@cox.net> wrote in message
news:hHhtb.10723$Q64.4495@fed1read03...
> with. You can use ID to 'name' a form, but javascript does not recognize
> "id".


document.getElementById()




All times are GMT. The time now is 08:31 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.