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 6 of 6
  1. #1
    Regular Coder RexxCrow's Avatar
    Join Date
    Jul 2006
    Location
    California
    Posts
    275
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Passing a filename as a var

    How is this done? I am trying to get a frame src to use one of 2 different HTML files for loading into a lower right frame based upon the browser version, so far all my attempts have failed I am using similar to:

    <frame src='dV+'".HTML"name="docView"scrolling="auto"marginwidth="5"marginheight="5"noresize>

    my JS at this point is (dV is the first part of the filename, I also tried it as a whole filename with .HTML and could not find that correct syntax out either):

    bVer=parseFloat(navigator.appVersion);
    bName=navigator.appName;
    if (bName == "Microsoft Internet Explorer" && bVersion < 7){
    dV="UpGrade"
    }else{
    dV="docView"
    }



    THX

  • #2
    Regular Coder RexxCrow's Avatar
    Join Date
    Jul 2006
    Location
    California
    Posts
    275
    Thanks
    6
    Thanked 2 Times in 2 Posts
    I still can't seem to get this figured out, if anybody can lend a hand, nothing seems to be working, UTL in my searching for a solution either. I am totally stuck on this one, darn it!


    Code:
    bVer=parseFloat(navigator.appVersion);
    bName=navigator.appName;
    dv="";
    if (bName == "Microsoft Internet Explorer" && bVersion < 6){
     dv="UpGrade";
    }else{
     dv="DocView";
    }
    //--></script>
    <frameset border="0"frameborder="0"framespacing="0"rows="149px,*">
    <frame src="Header.HTML"name="header"scrolling="no"marginwidth="5"marginheight="5"noresize>
    <frameset border="0"frameborder="0"framespacing="0"cols="250,*">
    <frame src="Menu.HTML"name="menu"scrolling="auto"marginwidth="5"marginheight="5"noresize>
    <frame src="'dv+'.HTML"name="docView"scrolling="auto"marginwidth="5"marginheight="5"noresize>
    </frameset></HEAD><BODY></BODY></HTML>

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,047
    Thanks
    0
    Thanked 251 Times in 247 Posts
    There are many ways to do what you want and one of them is to use IE Conditional Comments

  • #4
    Regular Coder RexxCrow's Avatar
    Join Date
    Jul 2006
    Location
    California
    Posts
    275
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Ok, I tried those and they do not seem to work in the head, and seem sort of limiting as it is only for IE, so if they are not using IE then it would trigger even if they had an up to date browser that was just another make. Is there no way to pass a string variable through to the frame source or another method that is not to difficult? I have attempted several ways and have failed, my limited knowledge in handling different files if x condition is met is driving me crazy! hahaa

  • #5
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    why do you even need different files?

  • #6
    Regular Coder RexxCrow's Avatar
    Join Date
    Jul 2006
    Location
    California
    Posts
    275
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Alright, think I got it functioning now, ran into a new prob though I did a long search for scripts that detect the actual browser version, seem they all only search for the first number which I do not think is correct, ie I am on IE7b and it stats I am on IE 4, one even told me I was on IE 5, like ok then?!?! Anybody know of one that works correctly or is that correct? I checked on MS website and there are about 20+ total major/minors. Now, using indexOf to get the name but how do you pull out at least the major version located to the right of the name? Looking at common scripts it appears they just look for number X and make a var Boolean based on that, but reads from left to right and pulls the first number it finds and move onto the next operation, correct? Thus, the number that you actually want is always missed. As in my below example I had to change it from 6 to 4 because I would always get flagged.

    using something similar to (but now I am lost for the rest of this):
    if(navigator.userAgent.indexOf("MSIE">-1){


    This is what I got working now:

    Code:
    bVer=parseFloat(navigator.appVersion);
    bName=navigator.appName;
    if (bName == "Microsoft Internet Explorer" && bVer < 4){
     window.location.reload('UpGrade.HTML');
    }else{
    ...
    }
    I was wanting them seperate to keep the files clean, as I am loading them in the same frame upon starting anyways, thought it would be best to make it a flowing process, but this is seeming to work good, except for the actual detection of the correct major version.


  •  

    Posting Permissions

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