Display Div with Javascript

I have a hyperlink in my html that displays a div popup on the same page I'm already on. see hyperlink below.  What I want to do is remove this from being displayed when the link is clicked, but display the div popup instead when a javascript function is called.

my existing URL that works:
<a href="#TB_inline?height=485&width=420&inlineId=blurp_remove" class="thickbox" >About us</a>

Any Ideas?  Thanks!
cmushaunAsked:
Who is Participating?
 
remorinaCommented:
The function you have is missing a closing } at the end

it should be
function getReply(var1) {
            if (var1 > 0) {
                tb_show('', '#TB_inline?height=485&width=690&inlineId=blurp_respond', '');
            }}

Otherwise there should be no reason for it not to work, I've also attached an example for you below calling your function on the "onchange" event of the dropdown, try selecting a different option from the dropdown list and it should work


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <title>TEST</title>
    <link rel="stylesheet" type="text/css" href="centerpointstyle.css" />
    <script type="text/javascript" src="http://jquery.com/src/jquery-latest.pack.js"></script>
    <script type="text/javascript" src="http://jquery.com/demo/thickbox/thickbox-code/thickbox-compressed.js"></script>
    <link rel="stylesheet" href="http://jquery.com/demo/thickbox/thickbox-code/thickbox.css" type="text/css" media="screen" />
    <script type="text/javascript">
        function getReply(var1) {
            if (var1 > 0) {
                tb_show('', '#TB_inline?height=300&width=400&inlineId=myOnPageContent', '');
            }}
    </script>
</head>
<body>
    <input alt="#TB_inline?height=300&width=400&inlineId=myOnPageContent" title="add a caption to title attribute / or leave blank" class="thickbox" type="button" value="Show" />  
    <a href="#TB_inline?height=155&width=300&inlineId=hiddenModalContent&modal=true"
        class="thickbox">Show hidden modal content.</a>
    <div id="myOnPageContent">
        <p>
            Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
            euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad
            minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip
            ex ea commodo consequat.</p>
        <p>
            <select name="" onchange="getReply(1);">
                <option>test</option>
                <option>test 2</option>
                <option>test 3</option>
            </select>
        </p>
    </div>
</body>
</html>

Open in new window

0
 
remorinaCommented:
Hi cmushaun,

Try
tb_show("", "#TB_inline?height=485&width=420&inlineId=blurp_remove", "");

0
 
cmushaunAuthor Commented:
Hello,

I tried this, did not launch the popup as is.  Do I need to define tb_show method?

Thanks,
Mike
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
remorinaCommented:
No it should work since it's the show method that already exists in the script
Are you using ThickBox for jquery?

To validate that it should work, open http://jquery.com/demo/thickbox/ then in the address/URL box of the browser type the following

javascript:tb_show("", "#TB_inline?height=155&width=300&inlineId=hiddenModalContent&modal=true", "");

it should launch the third example on the page for the inline content.

So maybe you're missing something?

Also are you troubleshooting with FireBug and getting any error messages ?

0
 
cmushaunAuthor Commented:
That does launch the popup on the jquery site, and I am using thickbox. I will install firebug now and check for errors.  Thanks! will post back with my results.
0
 
cmushaunAuthor Commented:
I think my problem is coming from calling this function call after a postback. ..Still digging in
0
 
remorinaCommented:
I see, postback sometimes causes issues, you should still be able to get this working after a postback, hope you get it working
0
 
cmushaunAuthor Commented:
Can you think of any reason this would display correctly if I use "onclientclick", enter this in the URL, but does not work when it is embedded in a JS function below:

        function getReply(var1) {

            if (var1 > 0) {
                tb_show('', '#TB_inline?height=485&width=690&inlineId=blurp_respond', '');
            }
0
 
cmushaunAuthor Commented:
Thanks for all your help so far.  I think I know why it is still not working for me.

I am trying to call this popup during a postback, but that is throwing it off somehow. I am trying to come up with a way to call it after the page is loaded again... Thanks for everything so far!
0
 
cmushaunAuthor Commented:
Thanks, Got it with this!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.