SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Iframe control works in MSIE not in Netscape

    What I have is a back page button as follows:
    Code:
            
            <input type="Button" name="Back" value="Back Page" 
    		onClick="this.page=document.forms['chapage'].elements['pge'];
    		this.chapt=document.forms['chapage'].elements['chp'];
    		this.pgid='Pg'+eval(this.page.value);
    		this.page.loc='document.there.'+this.pgid;
    		this.page.locC=this.page.loc+'.valueC';
    		this.page.locD=this.page.loc+'.valueD';
    		this.newchapt=eval(this.page.locC);
    		this.newpage=eval(this.page.locD);
    		there.location.href=this.newchapt+'.html#Pg'+this.newpage;">
    The frame name is "there", also, there are attributes that are taken out of an anchor on the page (valueC and valueD). it seems to fall apart because Netscape doesn't evaluate the "this.page.locC", which is in the "there" iframe

    How do I pull attributes from out of a frame?

    -berzerko

  2. #2
    What a twist! Kings's Avatar
    Join Date
    Jul 2002
    Location
    The Netherlands
    Posts
    954
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I remember having huge problems with iframes and netscape (think this was netscape 4 or 6). Netscape just wouldn't show my iframe. I decided to throw away the iframe and just use a table.

    Netscape and iframes don't mix very well...[img]images/smilies/xeye.gif[/img]
    Dennis Pallett - NoCertainty - My Personal Weblog
    The Web Network: ASPit | PHPit | WebDev-Articles
    Blogs: TalkFones | Holidayzer | PHPit Blog

  3. #3
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got it!, But have another question.

    To get it to work my anchors will need an Id instead of a name , but thats ok. Here is the code:

    Code:
            <input type="Button" name="Back" value="Back Page" 
    		onClick="this.page=document.forms['chapage'].elements['pge'];
    		this.chapt=document.forms['chapage'].elements['chp'];
    		this.pgid='Pg'+eval(this.page.value);
    		this.newchapt=frames['there'].document.getElementById(this.pgid).getAttribute('valueC');
    		this.newpage=frames['there'].document.getElementById(this.pgid).getAttribute('valueD');
    		this.chapt.value=this.newchapt;
    		this.page.value=this.newpage;				
    		frames['there'].location.href=this.chapt.value+'.html#Pg'+this.page.value;">
    Now for my question: how do I take the code in the tag and move it to a script and put a function in the code? For example: onClick="backpage();"

    -berzerko

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function backpage( elem )
    {
     elem.page=document.forms['chapage'].elements['pge'];
     elem.chapt=document.forms['chapage'].elements['chp'];
     elem.pgid='Pg'+eval(elem.page.value);
     elem.newchapt=frames['there'].document.getElementById(elem.pgid).getAttribute('valueC');
     elem.newpage=frames['there'].document.getElementById(elem.pgid).getAttribute('valueD');
     elem.chapt.value=elem.newchapt;
     elem.page.value=elem.newpage;	
     frames['there'].location.href=""elem.chapt.value+'.html#Pg'+elem.page.value;
    }
     
    ... onclick="backpage( this )" ...
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doesn't want to work for me. I tried the script between the head tags and between the head and body tag. single quotes and no quotes around "this"

    -berzerko

  6. #6
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then you'll have to show me your whole page, either via c&p or a link.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  7. #7
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I am using a file that I am in the process of butchering. Only the back page button is using the script. and I only have chapters 0 & 1 uploaded. Most of the Javascript on the page is there by include and only backpage() is being used at the moment

    Here it is The test page

    -berzerko

  8. #8
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's because both the function and the form have the same name "backpage". Change one and you should be okay.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  9. #9
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Changed form name, but it doesn't work yet.

    Q: what are the double quotes for on the following line: frames['there'].location.href=""elem.chapt.value+'.html#Pg'+elem.page.value;

    -berzerko

  10. #10
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Um, incorrect. They shouldn't be there at all. Dunno how they snuck in there...
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  11. #11
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We have a winner!!

    The quotes were screwing things up. Works great now!

    Thanks for your help again, Peter.

    -berzerko


Bookmarks

Posting Permissions

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