www.webdeveloper.com
Results 1 to 5 of 5

Thread: link inside a javascript popup

  1. #1
    Join Date
    Apr 2008
    Posts
    6

    link inside a javascript popup

    Hello everyone,

    I am having trouble getting past this problem. I know it is probably easy to fix, but I am still new and could use the help. I highlighted the text in red that I am having trouble with. I want the body of the popup to contain a link to google.com. I tried back slashing the " but that did not help. Here is the pop up code:

    Code:
    var popup;
    function initContent() {
    	if (popup && !popup.isOpen) {
    		var popBody = popup.document.body;
    		popBody.style.border = "solid 2px black";
    		popBody.style.padding = "10px";
    		popBody.style.fontSize = "16pt";
    		popBody.style.textAlign = "center";
    		var bodyText = "<P>put html here ";
    		bodyText += " <a href="http://www.google.com ">Click me</a> ";
    		bodyText += "<\/P>";
    		popBody.innerHTML = bodyText;
    	}
    }
    function createMyPopup() {
    	popup = window.createPopup();
    	initContent();
    	popup.show(300,200,400,100,document.body);
    }
    Last edited by LTLhawk; 05-04-2008 at 07:13 PM.

  2. #2
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    Try...
    bodyText += ' <a href="http://www.google.com ">Click me</a> ';

  3. #3
    Join Date
    Apr 2008
    Posts
    6
    Well, I get what looks like a link. It has blue underline text in the popup, but when I click on it nothing happens. Am I missing something?

  4. #4
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    I am not familiar with createPopup.
    It appears that it is an IE ONLY function, and who knows what will work when dealing with Micro$.

    I would suggest you use a <div> to perform this operation. That way you can make it work with any browser.

    Put a hidden (display:none) div with styling on your page, innerHTML the text to the div, and show the div (display:block)

  5. #5
    Join Date
    Apr 2008
    Posts
    6
    Thanks Nedals.. I will try that

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles