View Full Version : Need a little help

07-27-2007, 03:09 PM
Just doing a very basic coding change for my old man need a little help.

Have changed the web page perfectly, but i need the web page to come up in a new window, below is copy of current script. Have trid all the _blank stuff, but i must be missing something. Have highlighted web page link in blue. Please note this is custom page supplied by software company for users to change for own use.


<script language=javascript>

// Load text from resource file
function window_onload() {
var d = new Date()

document.all.lblEvents.innerText = objLang.LoadStringHTML(4031)
document.all.lblAddUser.innerText = objLang.LoadStringHTML(4032)

// Removed link buy and replace with customised page
document.all.lblBuy.innerText = objLang.LoadStringHTML(5900)
document.all.lnkBuy.href = "http://www.110uk.co.uk/index.html"(5901)
document.all.lnkBuy.title = objLang.LoadStringHTML(5900)

document.all.lblWatch.innerText = objLang.LoadStringHTML(5902)
document.all.lnkWatch.href = objLang.LoadStringHTML(5903)
document.all.lnkWatch.title = objLang.LoadStringHTML(5904)

document.all.lblDocs.innerText = objLang.LoadStringHTML(4040)

if ((objLang.LoadStringHTML(10) != "ENU") || (Math.abs(d.getTimezoneOffset() / 60) > 1))
document.all.idBuy.style.display = 'none';

if (objLang.LoadStringHTML(10) != "ENU")
document.all.idWatch.style.display = 'none';

function RolloverOn(theid) {
document.getElementById(theid).src = theid + ".png";
document.getElementById("lbl" + theid).style.color = "#3D5A8D";

function RolloverOff(theid) {
document.getElementById(theid).src = theid + "off.png";
document.getElementById("lbl" + theid).style.color = "#7A838A";


<link rel=stylesheet href="style.css" type="text/css">

<body bgcolor="White"
style="background: url(Net2 Background.gif) no-repeat bottom right fixed"
language=javascript onload="return window_onload()">

<table id="iconTable">
<td><a href="action:ViewEvents"><img id="Events" onmouseover="RolloverOn('Events')" onmouseout="RolloverOff('Events')" src="eventsOff.png" /></a><p id="lblEvents">lblEvents</p></td>
<td><a href="action:AddUser"><img id="AddUser" onmouseover="RolloverOn('AddUser')" onmouseout="RolloverOff('AddUser')" src="addUserOff.png" /></a><p id="lblAddUser">lblAddUser</p></td>

<td id="idBuy"><a href="lnkBuy" id="lnkBuy" target="_blank" title="lnkBuy"><img id="Buy" onmouseover="RolloverOn('Buy')" onmouseout="RolloverOff('Buy')" src="BuyOff.png" /></a><p id="lblBuy">lblBuy</p></td>

<td id="idWatch"><a href="lnkWatch" id="lnkWatch" target="_blank" title="lnkWatch"><img id="Watch" onmouseover="RolloverOn('Watch')" onmouseout="RolloverOff('Watch')" src="watchOff.png" /></a><p id="lblWatch">lblWatch</p></td>
<td><a href="action:ApplicationNotes"><img id="Docs" onmouseover="RolloverOn('Docs')" onmouseout="RolloverOff('Docs')" src="docsOff.png" /></a><p id="lblDocs">lblDocs</p></td>


width=0 height=0

Thanks very much for any pointers!

07-27-2007, 03:34 PM
I don't use javascript very much so I'm going to ask you why on earth you are calling your links like that!? Can't you just put the URL in the page?

And you should add a doctype to your page too as well as reading about Why Tables For Layout Is Stupid (http://www.hotdesign.com/seybold/) because at the moment the site is a coding mess!

07-27-2007, 03:50 PM
The entire page was written by a software company, the only part I have changed is highlighted in blue!...... not my fault, cant make head nor tail of it, (probably because it is such a mess) (plus i am pretty much a noob anyway). I managed to get the redirection sorted to the correct web page, but cannot make it appear in a new window, thats the only bit i need to change.

07-27-2007, 03:54 PM
When you say "_blank stuff" I presume this is what you've tried:

<a href="#" target="_blank">text</a>

That will open it in a new window, but will be invalid under Strict doctypes.

07-27-2007, 04:03 PM
Yeah that is exactly what i have tried!

hence i am pleading for help on the forum :)

07-27-2007, 04:24 PM
Come on people, this guy wasn’t asking for an opinion on the cleanliness of his code, nor does he care whether the target attribute will validate according to strict rules. He was merely asking how to achieve what he has in mind.

OK the fact that the code is really a mess doesn’t make it very easy for us to help but we shouldn’t confuse him more with momentarily irrelevant advice.

When I copied the code you provided and clicked on the link it opened a new window (tab in my case) so I don’t see a problem there. I just don’t get any page as the href isn’t changed to the respective URL.

And it’s giving me a JavaScript error: “objLang.LoadStringHTML is not a function”

07-27-2007, 04:57 PM
Come on people, this guy wasn’t asking for an opinion on the cleanliness of his code, nor does he care whether the target attribute will validate according to strict rules. He was merely asking how to achieve what he has in mind.

I think it is pretty relevant to know exactly what he has tried. He wasn't being very specific, so my post was rather a question to him actually, to see if he remembered the target attribute.