Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    139
    Thanks
    8
    Thanked 0 Times in 0 Posts

    non-validated script

    I have the following script in my web page:

    <SCRIPT TYPE="text/javascript">
    var ebimagetag='<iframe name="ebay-table" frameborder=0 WIDTH=430 HEIGHT=205 MARGINWIDTH=0 MARGINHEIGHT=0 ALIGN=CENTER src="auction.htm"></iframe>'

    var ebbutton='<iframe name="ebay-button" frameborder="0" WIDTH=92 HEIGHT=35 MARGINWIDTH=0 MARGINHEIGHT=0 ALIGN="CENTER" src="button.htm"></iframe>'

    var today=new Date()

    function ebexpireat(expiredate){

    var expire=new Date(expiredate)

    if (today.getTime()<=expire.getTime())
    document.write(ebimagetag)
    else
    document.write(ebbutton)
    }
    </script>

    When I use the W3C Validator, it tells me that it is wrong, and points out the "end tag for element "IFRAME" which is not open". I tried eliminating the </iframe> tag (in hopes that it was optional), but then the iframe doesn't show at all.

    Although that little W3C-approved sticker is not such a big deal, it's a source of pride that I can display it, and this is the only thing stopping me from doing so. Is there a better, approved way of scripting what I want?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You probably had incorrectly nested elements, which caused the validator to give you that error message. Try putting the IFRAME tags back in, but make sure that everything is nested correctly.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #3
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I use three different scripts from Dynamic Drive on my site currently and every single one does not validate. If I make the changes necessary for validation the script no longer works. I think the W3C validator needs some tweaking.

    MNS

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I bet I could make 'em validate. Got a link?
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #5
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ok. Give it your best shot. Here is one...

    <script language="JavaScript">

    //Comment trail script- By Kurt (kurt.grigg@virgin.net)
    //Script featured on Dynamic Drive
    //Visit http://www.dynamicdrive.com for this script and more

    colours=new Array('#D1C2D5','#D1C2D5','#D1C2D5','#D1C2D5','#D1C2D5','#D1C2D5','#D1C2D5','#D1C2D5','#D1C2D5')
    n = 8;
    y = 0;
    x = 0;
    n6=(document.getElementById&&!document.all);
    ns=(document.layers);
    ie=(document.all);
    d=(ns||ie)?'document.':'document.getElementById("';
    a=(ns||n6)?'':'all.';
    n6r=(n6)?'")':'';
    s=(ns)?'':'.style';
    if (ns){
    for (i = 0; i < n; i++)
    document.write('<layer name="dots'+i+'" top=0 left=0 width='+i/2+' height='+i/2+' bgcolor=#ff0000></layer>');
    }
    if (ie)
    document.write('<div id="con" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
    if (ie||n6){
    for (i = 0; i < n; i++)
    document.write('<div id="dots'+i+'" style="position:absolute;top:0px;left:0px;width:'+i/2+'px;height:'+i/2+'px;background:#ff0000;font-size:'+i/2+'"></div>');
    }
    if (ie)
    document.write('</div></div>');
    (ns||n6)?window.captureEvents(Event.MOUSEMOVE):0;
    function Mouse(evnt){
    y = (ns||n6)?evnt.pageY+4 - window.pageYOffset:event.y+4;
    x = (ns||n6)?evnt.pageX+1:event.x+1;
    }
    (ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
    function animate(){
    o=(ns||n6)?window.pageYOffset:0;
    if (ie)con.style.top=document.body.scrollTop;
    for (i = 0; i < n; i++){
    var temp1 = eval(d+a+"dots"+i+n6r+s);

    randcolours = colours[Math.floor(Math.random()*colours.length)];
    (ns)?temp1.bgColor = randcolours:temp1.background = randcolours;
    if (i < n-1){
    var temp2 = eval(d+a+"dots"+(i+1)+n6r+s);
    temp1.top = parseInt(temp2.top);
    temp1.left = parseInt(temp2.left);
    }
    else{
    temp1.top = y+o;
    temp1.left = x;
    }
    }
    setTimeout("animate()",120);
    }
    animate();
    // -->

    </script>

    AND HERE IS THE OTHERS...

    <script>

    //Thumbnail image viewer-
    // Dynamic Drive (www.dynamicdrive.com)
    //For full source code, usage terms, and 100's more DHTML scripts, visit http://www.dynamicdrive.com

    var ie=document.all
    var ns=document.layers
    var ns6=document.getElementById&&!document.all

    function enlarge(which,e){
    //Render image code for IE 4+ and NS6
    if (ie||ns6){
    crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
    if (crossobj.style.visibility=="hidden"){
    crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
    crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
    crossobj.innerHTML='<div align=right id=drag><b onClick=closepreview()>X</b></div><img src="'+which+'">'
    crossobj.style.visibility="visible"
    }
    else
    crossobj.style.visibility="hidden"
    return false
    }
    //Render image code for NS 4
    else if (document.layers){
    if (document.showimage.visibility=="hide"){
    document.showimage.document.write('<a href="#" onMouseover="drag_dropns(showimage)"><img src="'+which+'" border=0></a>')
    document.showimage.document.close()
    document.showimage.left=e.x
    document.showimage.top=e.y
    document.showimage.visibility="show"
    }
    else
    document.showimage.visibility="hide"
    return false
    }
    //if NOT IE 4+ or NS 4, simply display image in full browser window
    else
    return true
    }

    function closepreview(){
    crossobj.style.visibility="hidden"
    }

    </script>
    <script language="JavaScript1.2">

    //By Dynamicdrive.com

    //drag drop function for NS 4////
    /////////////////////////////////

    var nsx,nsy,nstemp

    function drag_dropns(name){
    temp=eval(name)
    temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
    temp.onmousedown=gons
    temp.onmousemove=dragns
    temp.onmouseup=stopns
    }

    function gons(e){
    temp.captureEvents(Event.MOUSEMOVE)
    nsx=e.x
    nsy=e.y
    }
    function dragns(e){
    temp.moveBy(e.x-nsx,e.y-nsy)
    return false
    }

    function stopns(){
    temp.releaseEvents(Event.MOUSEMOVE)
    }

    //drag drop function for IE 4+ and NS6////
    /////////////////////////////////

    function drag_drop(e){
    if (ie&&dragapproved){
    crossobj.style.left=tempx+event.clientX-offsetx
    crossobj.style.top=tempy+event.clientY-offsety
    }
    else if (ns6&&dragapproved){
    crossobj.style.left=tempx+e.clientX-offsetx
    crossobj.style.top=tempy+e.clientY-offsety
    }
    return false
    }

    function initializedrag(e){
    if (ie&&event.srcElement.id=="drag"||ns6&&e.target.id=="drag"){
    offsetx=ie? event.clientX : e.clientX
    offsety=ie? event.clientY : e.clientY

    tempx=parseInt(crossobj.style.left)
    tempy=parseInt(crossobj.style.top)

    dragapproved=true
    document.onmousemove=drag_drop
    }
    }

    document.onmousedown=initializedrag
    document.onmouseup=new Function("dragapproved=false")


    </script>

    MNS

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh, I meant a link to your page... can't validate the scripts alone, the entire HTML of your page must be validated with the scripts included.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #7
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ok. Here is the link to one page with the cursor script. My Test Page It passes except for 8 errors, 7 of which are in the cursor script. If I make the changes and put the doc type for 4.01 transitional into it the script ceases to work.

    The other files are in the zip. I do not have them up on the web yet. The same thing with them. They use the thumbnail script and if I make the changes and put the 4.01 transitional doc type on the page they cease to function in all browsers.

    I will be interested to see what you come up with because it has baffled me.

    MNS
    Attached Files Attached Files

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well I did it in XHTML 1.0 Strict for your test page, but it's really just a matter of going through each error step by step, and seeing how you can fix it.:

    http://validator.w3.org/check?uri=ht...tomatically%29

    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Posts
    139
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Originally posted by whammy
    You probably had incorrectly nested elements, which caused the validator to give you that error message. Try putting the IFRAME tags back in, but make sure that everything is nested correctly.
    Well, you can see how everything is nested by the code I posted. That is in the <HEAD> section of the page. I don't see anything in there that is out of place, but I would appreciate if you would have a look and see if you can spot what's wrong: http://www3.telus.net/beedersbeads/index.htm

  • #10
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Like I said though, when I fix the errors it says I have and attach the doc type the script doesn't work in older browsers. That my friend is the trick and the problem. I didn't try it in xhtml because I didn't think it was anywhere close to it by comparing the code to other xhtml pages I have seen. Most are either asp or php too though. Any luck with the other pages?

    MNS

  • #11
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Stickboy. These ae the erors I got from w3C when validating your page...

    1. Line 15, column 45: required attribute "TYPE" not specified (explain...).

    <SCRIPT LANGUAGE="JavaScript" SRC="images.js"></SCRIPT>
    ^

    2. Line 17, column 7: required attribute "TYPE" not specified (explain...).

    <script>
    ^

    3. Line 18, column 145: end tag for element "IFRAME" which is not open (explain...).

    ...IGN=CENTER src="auction.htm"></iframe>'
    ^

    4. Line 19, column 145: end tag for element "IFRAME" which is not open (explain...).

    ...GN="CENTER" src="button.htm"></iframe>'
    ^

    5. Line 29, column 144: end tag for element "IFRAME" which is not open (explain...).

    ...GN=CENTER src="auction2.htm"></iframe>'
    ^

    6. Line 30, column 145: end tag for element "IFRAME" which is not open (explain...).

    ...N="CENTER" src="button2.htm"></iframe>'
    ^

    7. Line 40, column 147: end tag for element "IFRAME" which is not open (explain...).

    ...GN=CENTER src="auction3.htm"></iframe>'
    ^

    8. Line 48, column 145: end tag for element "IFRAME" which is not open (explain...).

    ...GN=CENTER src="auction4.htm"></iframe>'
    ^

    9. Line 71, column 12: an attribute value must be a literal unless it contains only name characters (explain...).

    <HR WIDTH=25%>
    ^

    10. Line 93, column 7: required attribute "TYPE" not specified (explain...).

    <script>
    ^

    11. Line 98, column 7: required attribute "TYPE" not specified (explain...).

    <script>
    ^

    12. Line 103, column 7: required attribute "TYPE" not specified (explain...).

    <script>
    ^

    13. Line 108, column 7: required attribute "TYPE" not specified (explain...).

    <script>
    ^

    14. Line 114, column 44: required attribute "TYPE" not specified (explain...).

    <font size="2"><SCRIPT LANGUAGE="JavaScript">
    ^

    15. Line 127, column 38: end tag for element "A" which is not open (explain...).

    document.write('">Add to Favourites</a>');
    ^

    16. Line 137, column 10: end tag for element "P" which is not open (explain...).

    </font></p>
    ^

    17. Line 143, column 117: required attribute "ALT" not specified (explain...).

    ... HEIGHT=20 BORDER=0 HSPACE=4 VSPACE=2>
    ^


    To get rid of the iframe error someone told me in another thread to make the tag look like this <\/iframe> It gets rid of the error but then I couldn't get the script to work either. I have the </a> tags as well as </div> tags in the scripts I am using and it does the same thing. Fixes the errors according to the valifator but then the script ceases to function. That is why I said the w3C validator needs to recognize those as a necessary part of the script and not say it is an error. They need to TWEAK it.

    MNS

  • #12
    Regular Coder
    Join Date
    Jun 2002
    Posts
    139
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Agh! Look at all those errors!
    This is what happens when you validate the file while it's still on your computer - you forget to upload the corrections.

    Aside from that, I have implemented your backslash and lo and behold, it works! The page is validated and the code does what it's supposed to do.

    Thank you very much!

  • #13
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    That is great!! Glad it worked for you. If I do that with the scripts I am using, they validate but cease to work. I have asked for help with mine but haven't seen any.

    MNS

  • #14
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by MotherNatrsSon
    That is great!! Glad it worked for you. If I do that with the scripts I am using, they validate but cease to work. I have asked for help with mine but haven't seen any.

    MNS
    But your pages make the same errors as stickboy's!

    You left off the type="text/javascript" on the script tags and need to change the places where you have </ in your javascript with <\/ just like stickboy. Using HTML Tidy as a validator it took only a couple minutes to fix the problems (which are very few).
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #15
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yup, it only took a couple of minutes to fix them on that first page, even without HTML Tidy - but I'd try that.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •