Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Combine href w/ onclick for iframe lightbox

  1. #1
    Join Date
    May 2010
    Location
    Houston, TX
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Combine href w/ onclick for iframe lightbox

    Hello,

    I'm looking for a way to combine a URL destination with a highslide iframe "lightbox" application.

    The code below works perfectly as is. However, since I'm using it to pull up a contact form page, I want to make the hard-wired href link javascript too, in order to avoid form spam.

    <a title="Request appointment" ONMOUSEOVER="window.status='Request appointment';return true" ONFOCUS="window.status='Request appointment';return true" ONMOUSEOUT="window.status=''" href="request.php" onclick="return hs.htmlExpand(this, { objectType: 'iframe', objectHeight: 515, width: 500 } )">Request</a>

    How can I use javascript with the onclick event above to also access the request.php file?

    Thanks

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

    Default

    In the onclick event, the keyword "this" is used-- this refers to the current object, in this case the <a> tag.
    Usually this is used as "this.href" referring to the URL given in the tag. If it were that, you could just replace it with text.
    But since it's referring to the whole object, you may have to modify the function a bit to make this work.


    If you want help:
    1. Link to your page so we can actually see what's going on (there's a lot more code than what you've posted, and visiting the real page will give much more information than just a description).
    2. Link to the script(s) you are using so we can see what their documentation is, if needed.
    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
    May 2010
    Location
    Houston, TX
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    In the onclick event, the keyword "this" is used-- this refers to the current object, in this case the <a> tag.
    Usually this is used as "this.href" referring to the URL given in the tag. If it were that, you could just replace it with text.
    But since it's referring to the whole object, you may have to modify the function a bit to make this work.

    If you want help:
    1. Link to your page so we can actually see what's going on (there's a lot more code than what you've posted, and visiting the real page will give much more information than just a description).
    2. Link to the script(s) you are using so we can see what their documentation is, if needed.

    I was hoping someone could just take a blind shot at it.

    The website & page are not public at the moment; they're in development. I suppose if it's necessary, I could load up a dummy page and form w/ all the scripts in order to troubleshoot the issue.

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

    Default

    Correct, you should upload a page. Basing this metaphor on your username, asking us to help without seeing the details of the code is basically like asking a dentist to figure out what's wrong with someone's teeth before examining them.
    That little bit of code isn't enough to figure out what is wrong. (It might have been, but in this case it isn't.)
    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

  5. #5
    Join Date
    May 2010
    Location
    Houston, TX
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    Correct, you should upload a page. Basing this metaphor on your username, asking us to help without seeing the details of the code is basically like asking a dentist to figure out what's wrong with someone's teeth before examining them.
    That little bit of code isn't enough to figure out what is wrong. (It might have been, but in this case it isn't.)
    Point taken -- though for the record, I'm not a dentist!

    Let me see about getting some code up...

    jb

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

    Default

    Haha, no, that's fine, just a good reference point. I don't mean to complain either, but it's just really hard to guess what's wrong.
    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

  7. #7
    Join Date
    May 2010
    Location
    Houston, TX
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    Haha, no, that's fine, just a good reference point. I don't mean to complain either, but it's just really hard to guess what's wrong.
    Hey you're not complaining -- I totally understand & agree.

    Here, I put up a test page.

    jb

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

    Default

    The Javascript in the example is compressed, "encrypted". It'll need to be uncompressed (it's full, original, human-readable form) to adjust it. That's the file that needs to be changed.
    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

  9. #9
    Join Date
    May 2010
    Location
    Houston, TX
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    The Javascript in the example is compressed, "encrypted". It'll need to be uncompressed (it's full, original, human-readable form) to adjust it. That's the file that needs to be changed.
    Darn -- bummer.

    Oh well, w/o a method to avoid form spam, guess I won't be using it for live sites.

    Thanks just the same.

    jb

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

    Default

    If you are that worried about this and spam, you could dynamically write the code to the page using Javascript.
    Of course this will block some users from accessing the content, but it will also (probably) stop many bots. It won't stop people who are using it to spam, though, and there is a surprising amount of spam that is actually submitted by real people, and you can't really do much to stop that.
    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

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
  •