1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Open a link in a new window AND change the html on my own site?

Discussion in 'BlackHat Lounge' started by bookbuster, Feb 5, 2012.

  1. bookbuster

    bookbuster Newbie

    Joined:
    Mar 22, 2009
    Messages:
    42
    Likes Received:
    9
    Location:
    L.A.
    Hi everybody,

    Can one mouseclick open a sponsor site in a new window AND change the html on my own page??

    please help, thanks in advance.
    :)
     
  2. iulianh

    iulianh Regular Member

    Joined:
    Feb 3, 2008
    Messages:
    349
    Likes Received:
    501
    I don't really understand what you want but to open a link in a new window just use
    Code:
     <a href="" [B]target="_blank"[/B]>link</a>
     
    • Thanks Thanks x 1
  3. bookbuster

    bookbuster Newbie

    Joined:
    Mar 22, 2009
    Messages:
    42
    Likes Received:
    9
    Location:
    L.A.
    Yes thank you, I got that part, but I was wondering if my own page could reload as well with new content (on the same click). but... i think i need javascript??
     
  4. n3xus

    n3xus Junior Member

    Joined:
    Apr 19, 2009
    Messages:
    121
    Likes Received:
    31
    use javascript to edit the styles of the page..

    document.getElementById("whatever Id your editing").style.attribute = "change";

    create a javascript function that calls that, and the window.open() function with an onClick event.
     
    • Thanks Thanks x 2
  5. imprint

    imprint Junior Member Premium Member

    Joined:
    Nov 1, 2009
    Messages:
    151
    Likes Received:
    254
    Occupation:
    Entrepreneur/IM
    n3xus gave you the run down of it, you'll need two functions, one to handle the window.open part and the other to change your content. How much content do you need to change? If it's a lot, you may just want to redirect them to a new page and open the sponsor page at the same time, if it's something like you're just changing text from 'Click the sponsor linked' to 'Sponsor linked clicked', then just use another javascript function to trigger it.

    Example:
    Code:
    <html>
    	<head>
    		<script type="text/javascript">
    			function changeText(obj)
    			{
    				obj.innerHTML = "You've clicked the Sponsored Link";
    			}
    		</script>
    	</head>
    	<body>
    		<a href="#" onClick="changeText(this);window.open('http://google.com');">Click for Sponsored Link</a>
    	</body>
    </html>
    
     
    • Thanks Thanks x 2