Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exit Pop Up

Status
Not open for further replies.

caconner

Technical User
May 20, 2002
42
US
My experience with Javascript is severely limited, which is my disclaimer for the following question/problem.

I have to code links that take the user away from our site with a disclaimer and acknowledgement 'speed bump'. A link clicked on our site that leads to another will generate a pop up window with the verbiage and a button. After they click the button, they are redirected to the intended site. I cannot use server-side scripting with the host we use, but I read that variables can be passed between windows utilizing window.name.

I've decided to use an external file because as I refine this procedure, I need to set cookies that allow the user to choose not to display the message again. But at this point I just want to at least figure out how to accomplish this task before I confuse myself with the cookie issue, since I'm as inexperienced with cookies as I am with Javascript.

The external file includes the following code:
Code:
function openExt (id) {
if (window.name==link1) {
id="[URL unfurl="true"]http://www.consumer.gov/"[/URL]
}

window.open("../scripts/speed-bump.html", "", "toolbar=yes,resizable=yes,location=yes,directories=yes,status=yes,menubar=yes,width=600,height=500,scrollbars=yes,screenX=0,screenY=0,top=0,left=0", id)
}

function go()
{
id=window.name;
window.location=id;
}

The link on our site is coded as follows:
Code:
<a href="javascript: openExt(link1)" id="link1">Consumer Info 
        from the Federal Government</a>

The code on the speed bump page button is:
Code:
<input type="button"  class="button" value="Ok" onclick="go()" />

Can anyone tell me what I'm doing wrong?
 
Personally, I would pass variables in the URL (faq216-5442).
Is "Link1" a string or a variable? If it is a string, put quotes around it!

Also, what is openExt()?

--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakesperean sonnet.
 
Even better than quotes would be:

<a href="#" onclick="openExt(this.id); return false;" id="Link1">Consumer Info from the Federal Government</a>

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
and, as chessbot said, you'll need to surround Link1 with quotes in your function.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top