...

View Full Version : is this possible??



praveen
05-28-2004, 05:31 PM
one of my clients wants to modify his site and make it a tableless layout which is fine by me..

But,
i'll briefly outline the layout structure and wat he wants..

its going to be a 2 column layout..

the left one will have the site navigation and other links.. and in the main content layout, there will some links pointing to various doc files and pdf's.

now he wants all these pdf's docs to open in new windows.. but he does not want any "window.open" or any other js to be entered in the link tags..

he wants all the links in the content div to be just plain links.. a href="1.pdf"
and nothing else to be there..


so, i want to find out is there is a way to do that in js..

open the links in one div in a different way and the links in another div differently..

any help or tip is greatly appreciated and is of great help..

thanks..

Spudhead
05-28-2004, 05:41 PM
<a href="my.pdf" target="_blank">

??

praveen
05-28-2004, 05:45 PM
he doesnt want that ..

all he says and sticks by what he wants is..

<a href="1.pdf">1 pdf</a>

tats all he wants ..

s%^&$$ bloke.. wouldnt listen to anything..

he wants this and this only..

else he says he will take the project somewhere, which is not good, cos i ave already managed to finish all the other things except this one..

Vladdy
05-28-2004, 06:06 PM
If you really what to solve the problem ask him WHY he wants it.
First, why he wants the links open in a new window? Does he realize that pop-up blockers may make the site appear broken?
Second, what is wrong with adding target/scripting to the web page to accomplish the task?

On the same token, there is nothing wrong to get paid for what you have already done and tell him to take his unreasonable demands elsewhere.

Garadon
05-28-2004, 06:11 PM
pop up blockers shouldn't block windows opened with target blank.

and here is the code to your weird man lol, his request makes no sense to me and if javascript is disabled it will load the pdf's in the main window.


<html>
<body>
<div id="link" style="border:1px solid black">Link Div<a href="test1.html">test</a>
<a href="test1.html">test</a>
<a href="test1.html">test</a></div>
<div id="main" style="border:1px solid black">Main Div<a href="test1.html">test</a>
<a href="test1.html">test</a>
<a href="test1.html">test</a></div>
</body>
</html>
<script>
var mainDivLinks=document.getElementById('main').getElementsByTagName('a');
for(var i=0;i<mainDivLinks.length;i++)
{
mainDivLinks[i].target="_blank";
}
</script>

praveen
05-28-2004, 06:17 PM
thanks Garadon...

now to finish off this weird site

Garadon
05-28-2004, 06:26 PM
If your weird guy only want pdf to be popped he could make this alteration to the loop

for(var i=0;i<mainDivLinks.length;i++)
{
if(mainDivLinks[i].href.split('.')[mainDivLinks[i].href.split('.').length-1].toLowerCase()=='pdf')
mainDivLinks[i].target="_blank";
}

Willy Duitt
05-28-2004, 09:51 PM
It's not recommended but try using <BASE target="_blank"> in the head and collect your money and vow not to do any more work for such a stubborn fool. ;)

Garadon
05-28-2004, 11:15 PM
he couldn't do that since that would affect the other divs links to unless ofcourse he was allowed to write target on those.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum