View Full Version : Passing a filename as a var

08-06-2006, 01:22 AM
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):

if (bName == "Microsoft Internet Explorer" && bVersion < 7){


08-06-2006, 08:12 AM
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!

if (bName == "Microsoft Internet Explorer" && bVersion < 6){
<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>

08-06-2006, 09:57 AM
There are many ways to do what you want and one of them is to use IE Conditional Comments (http://www.javascriptkit.com/howto/cc2.shtml)

08-06-2006, 10:55 AM
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

08-06-2006, 12:21 PM
why do you even need different files?

08-06-2006, 01:43 PM
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):

This is what I got working now:

if (bName == "Microsoft Internet Explorer" && bVer < 4){

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.