A bit of coding/script help required (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


Taz -> A bit of coding/script help required (8/21/2004 10:43:21)

I need a little help getting this page to validate.
(Or find a work around/new script that does what this one does but doesn't set the W3C validator alarm bells ringing.)

http://ganjataz.com/smileys/1-index.htm


As you can see if you check the code source, I am using a script created by someone else, & it is kicking up errors when validated. Sadly I am no good at scripting so coding my own script is out, but this script does exactly what I want (Minus the errors it generates of course).

Anyone got any ideas or can offer help, it would be greatly appreciated as my desk is getting a tad annoyed with me banging my head against it. [image]http://www.ganjataz.co.uk/Forum/images/smiles/notfair.gif[/image]




Reflect -> RE: A bit of coding/script help required (8/21/2004 13:13:34)

What errors does the validation kick out?

Take care,

Brian




Taz -> RE: A bit of coding/script help required (8/21/2004 13:31:23)

I get 3 errors....

Line 16, column 29: required attribute "TYPE" not specified

<script language="JavaScript">

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.


Line 73, column 11: there is no attribute "NAME"

<form name="Which">

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.


Line 73, column 18: required attribute "ACTION" not specified

<form name="Which">

As all 3 are relating to the script I don't know what to change so the script still functions.

Here is the script/

INSTRUCTIONS:

Step One:  The Script
---------------------

Paste the following script into the <head> ... </head> of
your page.  There are no script set-ups needed.



<script language="JavaScript" type="text/JavaScript">

// Script Source: CodeLifter.com
// Copyright 2002
// Do not remove this notice

var isReady = false;

function showAddress(What){
  if (isReady){
    document.Which.Where.value = What;
    document.Which.Where.focus();
    document.Which.Where.select();
  }else{
    alert("This page is not fully loaded yet...\nPlease wait for the page to finish loading.");
  }
}

function clearAddress(){
  if (isReady){
    document.Which.Where.value = '';
  }else{
    alert("This page is not fully loaded yet...\nPlease wait for the page to finish loading.");  
  }
}

</script>



Step Two:  The Body Tag Onload Event
------------------------------------

Add onload="isReady=true" to your body tag, as shown below.
This is necessary to prevent false object calls prior to 
the page being fully loaded.  Thus:



<body onload="isReady=true">



Step Three:  The TextBox
-------------------------

Insert the following code for the text box in your page. (It
may be anywhere in your page.)  Do not change the form or
field names.



<form name="Which">
<input type="text" size="60" name="Where">
</form>



To clear the textbox from a link in the page, use this:



<a href="#" onClick="clearAddress()">
Clear
</a>



Step Four:  Attaching To The Images
-----------------------------------

You may attach the script to as many images as you wish. To
attach to the image add onMouseDown="showAddress(this.src)"
to the img src tag, as shown in the sample below.

Simple code

<img src="http://ganjataz.com/Forum/images/smiles/smileybanner.jpg"
        onMouseDown="showAddress(this.src)">


Cheers.

Edited so the full script & instructions are included
(Forgot to add that from all the headbanging on the desk.)




d a v e -> RE: A bit of coding/script help required (8/21/2004 13:41:50)

<script language="JavaScript" type="text/JavaScript">
is the first one, not sure about the other 2 yet




Taz -> RE: A bit of coding/script help required (8/21/2004 13:49:46)

w00t! [image]http://ganjataz.com/Forum/images/smiles/cool-up.gif[/image]

One down, 2 to go!

/hands you a cookie




Giomanach -> RE: A bit of coding/script help required (8/21/2004 14:01:27)

<form name="which" action="">

Dan




Taz -> RE: A bit of coding/script help required (8/21/2004 14:20:55)

<form name="which" action="">

What would I put between the two ""

Cos just adding that code stops the script doing what it should. 0-o




reric -> RE: A bit of coding/script help required (8/23/2004 8:14:38)

try action="self"?




Taz -> RE: A bit of coding/script help required (8/23/2004 11:03:21)

No joy, stops the URL showing in the form box, thus making it useless. :(




reric -> RE: A bit of coding/script help required (8/23/2004 11:35:34)

quote:

This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).


change the heading from "strict" to "Transitional"?




Taz -> RE: A bit of coding/script help required (8/23/2004 13:37:46)

"<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">"

Is what I am using.




reric -> RE: A bit of coding/script help required (8/23/2004 14:50:04)

I took your code from your page and added this:

<form name="Which" action="post"> and it still worked for me.

hope this works for you




Taz -> RE: A bit of coding/script help required (8/23/2004 14:55:01)

HUZZAH!

2 down, 1 left!

/hands you a cookie [image]http://ganjataz.com/Forum/images/smiles/happy.gif[/image]

Many thanks.




reric -> RE: A bit of coding/script help required (8/23/2004 15:05:08)

Thanks. chocolate chip? number 3 the "w" is capitalized. Try changing that to lower case




Taz -> RE: A bit of coding/script help required (8/23/2004 15:10:24)

Double choc chip. ;)

If I change the case for the W it stops the script working again *considers banging head on desk again*

"Line 73, column 11: there is no attribute "NAME"
W3C results for page/error

So close, yet so far *cries*




d a v e -> RE: A bit of coding/script help required (8/24/2004 1:13:09)

it might be that you need to change 'name' to 'id'

http://www.w3.org/TR/html401/interact/forms.html#edef-FORM
quote:

name = cdata [CI]
This attribute names the element so that it may be referred to from style sheets or scripts. Note. This attribute has been included for backwards compatibility. Applications should use the id attribute to identify elements.




Taz -> RE: A bit of coding/script help required (8/24/2004 9:29:18)

Again it stops the script working, thanks though.




reric -> RE: A bit of coding/script help required (8/24/2004 10:00:51)

notice in the script all the W's are capitalized? change all the capital w's to lower case that is in the code within the script tags. and then you can change the name of the form to a lower case.

this also works for me




Taz -> RE: A bit of coding/script help required (8/24/2004 11:41:53)

Done & yes it works, but still I am left with the last error,
"Line 73, column 11: there is no attribute "NAME"

Changing that to "id" stops it working, but the page validates as compliant HTML.

[image]http://www.ganjataz.co.uk/Forum/images/smiles/swearbubble.gif[/image]

Great that I now have a valid page, not so great that the page does not do what it is supposed to.
(Or am I missing something?)

*mutters many swearwords at W3C*




reric -> RE: A bit of coding/script help required (8/24/2004 12:16:50)

would <a name="which"> work? it does here but dont know if it validates

here is the complete code :

<form name="which" action="post">
<p>Smiley URL <a name="which">
<input type="text" size="60" name="where" action="post"></a> <a href="#" onClick="clearAddress()">
Clear the URL.
</a>




Taz -> RE: A bit of coding/script help required (8/24/2004 12:31:46)

Again it is the validation errors I am trying to defeat*, along with the script working.
It works but does not validate.

*Or finding an alternate work around so that my surfers can easily click on a smiley & get the URL for it in roughly the same manner as this code does.

I am fighting to get my site W3C valid & X-Broswer compliant/compatible, something I am now wishing I never bothered with. [&:]

Ignorance was bliss....[8|]

Cheers foir the time & effort though, it is appreciated.




Taz -> RE: A bit of coding/script help required (8/24/2004 21:07:32)

Issue resolved!

A small tweak in the doc type resolved the issue. [image]http://ganjataz.com/Forum/images/smiles/happyspin.gif[/image]




reric -> RE: A bit of coding/script help required (8/25/2004 9:04:35)

cool. glad you got it resolved. COOKIE FOR YOU




Taz -> RE: A bit of coding/script help required (8/25/2004 13:04:41)

Hahaha, I am glad it is now working as I want, it would have been a shame to have parts of my site uncompliant when I worked so hard getting the other areas compliant.

Thanks for the cookie, & thanks all again for the help, it really is appreciated. =]

The first part of my smiley section is now online, so please feel free to use any of my smileys.
http://ganjataz.com/smileys/menu.htm

I got a load more smileys yet to be added, but the first upload of smileys is available for posting.[image]http://www.ganjataz.co.uk/Forum/images/smiles/grinn.gif[/image]




reric -> RE: A bit of coding/script help required (8/26/2004 8:29:38)

Your quite welcome and because of your post I got into validating and received my first html 4.01 validation yesterday for a plate I am working on so thank you.

ERic




d a v e -> RE: A bit of coding/script help required (8/26/2004 8:33:52)

quote:

ORIGINAL: reric

Your quite welcome and because of your post I got into validating and received my first html 4.01 validation yesterday for a plate I am working on so thank you.

ERic


where did you go to get your plate validated ;)




Donkey -> RE: A bit of coding/script help required (8/26/2004 8:54:27)

quote:

where did you go to get your plate validated ;
I too would like to know because none of my plates have been validated and I'm worried that they may not be compliant. (They are dishwasher and microwave safe)
What about cutlery? That could be a problem; do you have to validate it for use with specific plates or is there a general standard. Should I stop using it just to be safe?




Giomanach -> RE: A bit of coding/script help required (8/26/2004 8:59:01)

Taz....now here's a smilie I agree with...

[image]http://www.ganjataz.co.uk/Forum/images/smiles/faithless-rule_banner.gif[/image]

[:D]

quote:

I too would like to know because none of my plates have been validated and I'm worried that they may not be compliant. (They are dishwasher and microwave safe)
What about cutlery? That could be a problem; do you have to validate it for use with specific plates or is there a general standard. Should I stop using it just to be safe?


Viewing through IE, the Window, FF or Opera?




reric -> RE: A bit of coding/script help required (8/26/2004 14:06:18)

hee hee you all are funny![:D] Glad you all had a little laugh :)




Taz -> RE: A bit of coding/script help required (8/26/2004 16:42:21)

quote:

ORIGINAL: Giomanach

Taz....now here's a smilie I agree with...

[image]http://www.ganjataz.co.uk/Forum/images/smiles/faithless-rule_banner.gif[/image]

[:D]

=]
Damn skippy they do!

I was lucky enough to see them again a few months back. Met Aubrey at long last. (Bass player, tour manager & Webmaster of their site.)
Hopefully will be seeing them again later this year for the No Roots tour.

So, whats ya fave track/album?

quote:

ORIGINAL: reric

Your quite welcome and because of your post I got into validating and received my first html 4.01 validation yesterday for a plate I am working on so thank you.

ERic

Awesome. [:)]




Page: [1] 2   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.109375