Results 1 to 5 of 5

Thread: opening in a new window

  1. #1
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default opening in a new window

    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"

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    '<a href="http://.....">'

    Or,
    "<a href=\"http://...\">'
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Quote Originally Posted by djr33 View Post
    '<a href="http://.....">'

    Or,
    "<a href=\"http://...\">'
    Or

    Code:
    "<a href='http://www.google.com'>Visit Google</a>"

  4. #4
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    This script gives me an error. What have I done wrong?

    middleAdvertLink = "<a href=""http://www.theranger.co.uk"" target="_blank">"

  5. #5
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Quote Originally Posted by eurows View Post
    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

    Code:
    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

    Code:
    <!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>
    Last edited by codeexploiter; 08-31-2007 at 07:02 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •