View Full Version : opening in a new window
eurows
08-31-2007, 06:26 AM
I am having the most ridiculous of problems. I need to tell this link to open in a blank window but as it has double quotes I seem to error wherever it goes.
Can anyone help
this is the javascript
middleAdvertLink = "<a href=""http://www.link.co.uk"">"
where do i put target="_blank"
djr33
08-31-2007, 06:29 AM
'<a href="http://.....">'
Or,
"<a href=\"http://...\">'
codeexploiter
08-31-2007, 06:43 AM
'<a href="http://.....">'
Or,
"<a href=\"http://...\">'
Or
"<a href='http://www.google.com'>Visit Google</a>"
eurows
08-31-2007, 06:47 AM
This script gives me an error. What have I done wrong?
middleAdvertLink = "<a href=""http://www.theranger.co.uk"" target="_blank">"
codeexploiter
08-31-2007, 06:51 AM
This script gives me an error. What have I done wrong?
middleAdvertLink = "<a href=""http://www.theranger.co.uk"" target="_blank">"
The above mentioned code will gives you error because you've used double quotes within double quotes which is not the correct usage.
You can use the following
middleAdvertLink = "<a href='http://www.theranger.co.uk' target='_blank'>"
I think you need the same value you've mentioned in your query.
Following is an example of the same
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
</style>
<script type="text/javascript">
window.onload = function() {
var aElem = "<a href='http://www.google.com' target='_blank'>Visit Google</a>";
document.getElementById('one').innerHTML = aElem;
}
</script>
</head>
<body>
<div id="one"></div>
</body>
</html>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.