#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    14
    Rep Power
    0
    I have a website containing a large number of links

    all based on the following

    <td width="32" height="19" bgcolor="#FFFFFF">
    <a href="javascriptpen3210('501161110771*101**1065259280965259680501161110771*101**106525928096656958069786958011111333 36958695668595.086586958011111333369586951*7**879791*8 Tempo = 300')">3210/3310</a></td>


    In each page (as there about 50) I have the following line

    <script src="http://www.ringtones4all.com/js/script.js">
    </script>


    in that script file the following function


    function open3210(C3210)
    {

    var OpenWindow=window.open('', '' ,config='height=260,width=380,toolbar=0,menubar=1,status=0,location=0');

    OpenWindow.document.write("<head>")
    OpenWindow.document.write("<title>3210 Codes</title>")
    OpenWindow.document.write("</head>")
    OpenWindow.document.write("<p><TEXTAREA name='C3210' COLS=40 ROWS=10>")
    OpenWindow.document.write(C3210)
    OpenWindow.document.write("</TEXTAREA> <BR></p>")
    OpenWindow.document.write("<table border='0' width='338'>")
    OpenWindow.document.write("<tr> <td width='330'> <p align='center'>")
    OpenWindow.document.write("<input type=button value='Highlight All' onClick='javascript:C3210.select();'>")
    OpenWindow.document.write("<a href='http://www.geocities.com/ring_tones/menu/help.htm'>")
    OpenWindow.document.write("<input type=button value='Help'>")
    OpenWindow.document.write("</a><input type=button value='Print' onClick='javascript:window.print()';>")
    OpenWindow.document.write("</a><input type=button value='Close Window' onClick='javascript:self.close()';>")
    OpenWindow.document.write("</Table>")
    OpenWindow.document.write("</html>")

    }

    All fairly basic stuff, I get over 10 000 hits per week but about 10 or 12 complaints about an error when they click the link

    runtime error has occured. Line 47.

    I have tested this on a number of machines and cannot replicate the error

    any ideas ???

    Mike
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    81
    Rep Power
    14
    I see several things that you might want to correct, but nothing that jumps out that would cause your script error.

    Some suggestions on things you might want to fix:

    - The second parameter to the window.open call should be the name of the window, leaving it empty could cause problems

    - Before and after writing to the new document call the "open" and "close" routines, as follows:

    OpenWindow.document.open();
    OpenWindow.document.write('etc., etc.');
    OpenWindow.document.close();

    - In your function output you have a close "</hmtl>" tag, but no open "<html>" tag

    - The last two button tags are preceeded with a "</a>" closing anchor tag, but there is no open anchor tag

    - The TR & TD tags don't have closing tags

    Finally, I have seen some weird timing interaction with creating a new window and then trying to do things with it. At the time we were trying to create and access variables in the new window, which is a little different from what you are doing here.
    Robert Dominy
    About Guide for JavaScript
    http://javascript.about.com
    Software Consulting & Development
    http://www.angusog.com
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    14
    Rep Power
    0

    AOL


    I've been asking the users of my Site what Browser they use and All use IE5, which when tested on 20+macines at work and home works fine

    The common factor appears to be AOL ???

    Anyone any ideas ??


    Mike
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    81
    Rep Power
    14
    The built-in browser to AOL is a bastardized version of IE that does exhibit some quirks. I remember now having a problem very similar to the one you have, but don't quite remember how we resolved it.

    I'm betting that if your AOL users launch IE as a separate application (instead of using the built-in AOL one) that everything will work just fine.

    I will double-check with a colleague who might remember who we fixed this problem before and let you know....
    Robert Dominy
    About Guide for JavaScript
    http://javascript.about.com
    Software Consulting & Development
    http://www.angusog.com
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Dublin
    Posts
    413
    Rep Power
    14
    What is on line 47? The error details you supply are a bit sketchy, so I may have this completely wrong...

    In particular this has nothing to do with AOL, I'm afraid!!

    The frequency of the errors does, however remind me of something:
    I have had problems in the past where I use the <script src= .. > tag. The script aren't loaded sequentially as read, but are loaded separately - like images. As such there can be significant delays between the main page being loaded and the script's functions being available to call. Note, however, that generally speaking small script will be loaded almost immediately. You may need to test that the function is loaded before you can call it. I'd suggest that you add a wrapper function to each page as follows:
    Code:
    <script src="http://www.ringtones4all.com/js/script.js"> 
    </script><script language=javascript><!--
    &nbsp;&nbsp;function doOpen3210(C3210) {
    &nbsp;&nbsp;&nbsp;&nbsp;if (open3210) {open3210(C3210);}
    &nbsp;&nbsp;&nbsp;&nbsp;else {setTimeout("doOpen3210(\""+C3210+"\")",200);}
    &nbsp;&nbsp;}
    //--></script>
    This will keep trying to call the function until successful - ie until the function has loaded
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    14
    Rep Power
    0
    Sorry I got my user with the problem to use that Wrapper and it still refused to open the Window

    I'm not sure what is on line 47 as I include the javascript as a text file, and I think it counts the line in there, I have attached the javascript file I use in case that helps

    function playmidi(midi,tit)
    {
    ringurl = "http://www.ringtones4all.com/cgi/preview.cgi?" + midi;
    window.open(ringurl,"","scrollbars=no,status=no,location=no,toolbar=no,menu=no,width=226,height=200" );
    }


    function openwind(page)
    {
    window.open(page, '', config='height=200,width=400,toolbar=0,menubar=1,status=0,location=0')
    }

    function opencwind(page)
    {
    window.open(page, '', config='height=160,width=380,toolbar=0,menubar=1,status=0,location=0')
    }


    function opennok(nokring)
    {

    var OpenWindow=window.open('', '' ,config='height=260,width=380,toolbar=0,menubar=1,status=0,location=0');

    OpenWindow.document.write("<head>")
    OpenWindow.document.write("<title>Nokring Codes</title>")
    OpenWindow.document.write("</head>")
    OpenWindow.document.write("<p><TEXTAREA name='Nokring' COLS=40 ROWS=10>")
    OpenWindow.document.write(nokring)
    OpenWindow.document.write("</TEXTAREA> <BR></p>")
    OpenWindow.document.write("<table border='0' width='338'>")
    OpenWindow.document.write("<tr> <td width='330'> <p align='center'>")
    OpenWindow.document.write("<input type=button value='Highlight All' onClick='javascript:Nokring.select();'>")
    OpenWindow.document.write("<a href='http://www.ringtones4all.com/menu/help.htm'>")
    OpenWindow.document.write("<input type=button value='Help'>")
    OpenWindow.document.write("</a><input type=button value='Print' onClick='javascript:window.print()';>")
    OpenWindow.document.write("</a><input type=button value='Close Window' onClick='javascript:self.close()';>")
    OpenWindow.document.write("</Table>")
    OpenWindow.document.write("</html>")

    }

    function open3210(C3210)
    {

    var OpenWindow=window.open('', '' ,config='height=300,width=380,toolbar=0,menubar=1,status=0,location=0');

    OpenWindow.document.write("<html>")
    OpenWindow.document.write("<head>")
    OpenWindow.document.write("<title>3210 Codes</title>")
    OpenWindow.document.write("</head>")
    OpenWindow.document.write("<p><TEXTAREA name='C3210' COLS=40 ROWS=10>")
    OpenWindow.document.write(C3210)
    OpenWindow.document.write("</TEXTAREA> <BR></p>")
    OpenWindow.document.write("<p align='center'>[ <b> .</b> ] = Hold the preceding key a little longer</p>")
    OpenWindow.document.write("<table border='0' width='338' align='center'>")
    OpenWindow.document.write("<input type=button value='Highlight All' onClick='javascript:C3210.select();'>")
    OpenWindow.document.write("<input type=button value='Print' onClick='javascript:window.print()';>")
    OpenWindow.document.write("<input type=button value='Close Window' onClick='javascript:self.close()';></p>")
    OpenWindow.document.write("<a href='http://www.ringtones4all.com/menu/help.htm' target='_blank'>Need Help ??? then check out our step by step guides</a>")
    OpenWindow.document.write("</Table>")
    OpenWindow.document.write("</html>")

    }

    function openc25(c25)
    {

    var OpenWindow=window.open('', '' ,config='height=260,width=380,toolbar=0,menubar=1,status=0,location=0');

    OpenWindow.document.write("<head>")
    OpenWindow.document.write("<title>C25 Codes</title>")
    OpenWindow.document.write("</head>")
    OpenWindow.document.write("<p><TEXTAREA name='c25' COLS=40 ROWS=10>")
    OpenWindow.document.write(c25)
    OpenWindow.document.write("</TEXTAREA> <BR></p>")
    OpenWindow.document.write("<table border='0' width='338'>")
    OpenWindow.document.write("<tr> <td width='330'> <p align='center'>")
    OpenWindow.document.write("<input type=button value='Highlight All' onClick='javascript:c25.select();'>")
    OpenWindow.document.write("<a href='http://www.geocities.com/ring_tones/menu/help.htm'>")
    OpenWindow.document.write("<input type=button value='Help'>")
    OpenWindow.document.write("</a><input type=button value='Print' onClick='javascript:window.print()';>")
    OpenWindow.document.write("</a><input type=button value='Close Window' onClick='javascript:self.close()';>")
    OpenWindow.document.write("</Table>")
    OpenWindow.document.write("</html>")

    }
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    14
    Rep Power
    0
    Your right, AOL does cause the problem if the user simply starts the browser from the desktop, rather than using it through AOl the links work fine

    Thanks to everyone for there help

    Mike

IMN logo majestic logo threadwatch logo seochat tools logo