[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Many links with the same Target

Posted on 2003-11-10
6
Medium Priority
?
168 Views
Last Modified: 2010-04-09
Hi lads,
I've got, say, 2 links with the same target, such:

<a href="hello.htm#1" target="MyIFrame2">Bookmark 1</a>
<a href="hello.htm#2" target="MyIFrame2">Bookmark 2</a>

Now, is there any way I could use a CSS or whatever to specify that all these links have the same target?, I just want to get rid of the target="MyIFrame2" bit. I know it sounds stupid but I'm writing a 1MB HTML (with hundreds of links with the same target) page and trying to get rid of as much text as I can. To make things more difficult, I've got two frames, left & right, with an IFRAME on each page. The links you see above go into the first IFRAME, and try to bookmark on the second IFRAME. Is that clear?, hope so ...
Any ideas guys?, remember, trying to change target="MyIFrame2" to something like onclick="DoSomething()" and with javascript handle the call, wouldn't change the size of my HTML file since I'd have to replace target="MyIFrame2" with onclick="DoSomething()", for this reason I mentioned a CSS before ...
Thanks in advance

T
0
Comment
Question by:AntoniL
6 Comments
 
LVL 19

Expert Comment

by:webwoman
ID: 9717799
>>I'm writing a 1MB HTML (with hundreds of links with the same target) page and trying to get rid of as much text as I can.

Don't. Nobody will EVER look at it. The browser will probably time out before it completely loads. 1MB is WAY too big for one page. BREAK IT UP.

And seriously think about getting rid of the iframe.
0
 
LVL 31

Accepted Solution

by:
seanpowell earned 200 total points
ID: 9717954
<html>
<head>
<title>Go grap a coffee or two</title>
<base target="MyIFrame2">
</head>
<body>
etc...
0
 
LVL 19

Expert Comment

by:webwoman
ID: 9718965
Don't encourage them... ;-)

Unless, of course, you also tell them to add that 2.5 mb wav file as a background sound...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 11

Expert Comment

by:Zontar
ID: 9720237
You could also use DOM to set the target property dynamically.

The exact script would depend on how your document is structured. For instance, if all the links to point to a particular target are in one section indicated by <div id="section1">...</div> then you can do this:

<script type="text/javascript">
 window.onload = fixTargets;

function fixTargets()
{
  var sectionOneDiv = document.getElementById("section1");
  var sectionOneLinks = sectionOneDiv.getElementsByTagName("a");

  for(var i = 0; i < sectionOneLinks.length; i++)
    sectionOneLinks[i].target = "MyIFrame1";
}
</script>

This could be generalised for many sections of a document/many targets.
0
 

Author Comment

by:AntoniL
ID: 9720766
Thanks Georgemarian, it did work. Thanks also to webwoman, got a tissue to wipe my tears off?
Cheers lads, see u around

T
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9720974
You're welcome - and here's to unlimited bandwidth :-)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question