How to change base href using variables.
I need to know how to switch the base ref in mid stream and then change it back to the original after processing some area of the page.
Can it be done someway with variables like shown below?
Of course this does not work. I know if I type actual addresses into each base href, it will work but I need to do it with variables.
When I use <base href=http://www.codingforums.com/archive/index.php/"http://www.vahud.com"> it works fine, but I need to use variables to change the ref website.
Can anyone help here?
See example below
<html>
<head>
<script>
orig="http://www.vahud.com/";
ref2="http://www.govhome4u.com/";
ref3="http://www.vahudhome4u.com/";
</script>
</head>
<body>
(This is a photo from vahud.com)<br>
<base href=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/orig>
<img src= http://www.codingforums.com/archive/index.php/"images/photo1.jpg"><br>
(This is a photo from govhome4u.com)<br>
<base href=http://www.codingforums.com/archive/index.php/ref2>
<img src=http://www.codingforums.com/archive/index.php/"images/photo2.jpg"><br>
(This is a photo from vahudhome4u.com)<br>
<base href=http://www.codingforums.com/archive/index.php/ref3>
<img src=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"images/photo3.jpg"><br>
(This is a photo from vahud.com)<br>
<base href=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/orig>
<img src=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"images/photo3.jpg"><br>
</body>
</html>
Willy Duitt
12-01-2004, 09:32 PM
I know if I type actual addresses into each base href, it will work but I need to do it with variables.
Why???
That makes absolutely no sense...
Please enlighten us as to why this is necassary...
....Willy
Edit: You could also look here (http://www.webdeveloper.com/forum/showthread.php?s=&threadid=50388) and here (http://www.webmasterworld.com/forum91/2825.htm) both of which were posted within minutes of this one...
tommytx
12-01-2004, 11:14 PM
Here is why?
Take a look at the link below.
Check this out (http://www.vahud.com/vahud/va_tom.htm)
I don't want to hard wire all the top buttons or all the bottom buttons as this will be used on a lot of domains.
Sooooo....This actual page will reside on vahud.com/vahud and will be called from many other sites. so I want the top buttons to be referenced to a different web than the one it is located on.
It works great with the switching of the base ref manually, but I want to do it auto. The only thing I need is to find a way to use a variable for the base href vice having to hard wire such as <base href=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"http://www.vahud.com">
I can change the ref as much as I want, but I can't figure any way to do it thru variables.
All the top buttons will be referenced to the calling website.
All the center pictures will allways ref the vahud.com/vahud website.
All the bottom buttons will be refereced to the calling website.
It works fine now, but all the buttons are hardwired at the top and the bottom. With a variable, the system could take care of it automatically.
thanks for your help
Tom
tommytx
12-01-2004, 11:57 PM
Here is some additional information that better demonstrates what I am trying to do.
See A Sample (http://www.vahud.com/test.htm)
This is exactly what I want to do, without having to enter the long full hard wired web addresses, I want to enter the address into a variable and apply it to the <base href=http://www.codingforums.com/archive/index.php/variable>. However I understand there may be no way to get a variable javascript or anything else to work here.
If you have constructive ideas, please share them with me.
Tom
hemebond
12-02-2004, 12:10 AM
It doesn't look like it's possible. You be better off using a server-side language to do it.
tommytx
12-02-2004, 12:30 AM
You are probably right, but it would be great if someone does have an idea on a way to do this. I have seen many things that I thought impossible solved.
I do have php included with this particular domain and could use that but I have always had concern the on the fly generated pages like perl, asp, php got a lesser ranking on search engines since the page doesn't even exist until called for. Does anyone have any + or - on this. I know this is not a search engine forum, just thought I would ask anyway. Thanks for your input anyway.