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.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I have a problem with a javascript script.?

    I have 2 iframes id="Frame" and id="Frameinfo".
    My script is very simple:

    Code:
    Code:
    function update(url){
    document.getElementById('Frameinfo').src=url
    }
    This function is activated by
    Code:
    Code:
    onLoad="update('inbox.php')"
    Now I get tis error:
    document.getElementById(...) is null or not an object

    What am I missing here?

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,535
    Thanks
    3
    Thanked 513 Times in 500 Posts
    check that the id of id=Frameinfo is indeed Frameinfo and id="Frameinfo" is not repeated in the document.
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Allow me to give you the full code:

    Main page code (Parent window):
    Code:
           <center><iframe name="Frame" id="Frame" SRC="blank.html" width=950 height=60 frameborder=1 marginwidth=0 marginhight=0 frameborder=0 Scrolling="no"></center>
           <center><iframe name="Frameinfo" id="Frameinfo" SRC="blank.html" width=950 height=420 frameborder=1 marginwidth=0 marginhight=0 Scrolling="yes"></center>
    Code in iFrame id=Frame:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    
    <html>
    <head>
    	<title>Untitled</title>
    	<script language="Javascript">
        function update(url){
        			 document.getElementById('Parent.Femeinfo').src=url
    	}
    	</script>
    </head>
    
    <body bgcolor=#a5b395 onLoad="update('Inbox.php')">
    <br>
    <table border=1 width=930>
        <tr>
            <td width=40 height=30>
        		<b><center>Urgent</center></b>
        	</td>
        	<td width=450>
        		<b><center>Subject</center></b>
        	</td>
        	<td width=250>
        		<b><center>From</center></b>
        	</td>
        	<td width=150>
        		<b><center>Time Posted</center></b>
        	</td>
        	<td width=40>
        		<b><center>Read</center></b>
        	</td>
        </tr>
    </table>
    
    </body>
    </html>
    I hope this will help. I am totaly lost nd new to javascript.

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Change this line

    document.getElementById('Parent.Femeinfo').src=url

    to

    parent.document.getElementById('Frameinfo').src=url


    see if that works
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #5
    Regular Coder
    Join Date
    Jun 2007
    Location
    USA
    Posts
    527
    Thanks
    26
    Thanked 74 Times in 72 Posts
    Irrelevant to your problem, I would also like to point out with your
    Code:
    <script language="Javascript">
    to use the following instead:
    Code:
    <script type="text/javascript">
    Trinithis


  •  

    Posting Permissions

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