Results 1 to 18 of 18

Thread: [RESOLVED] # page load

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Resolved [RESOLVED] # page load

    PHP Code:
    echo '  <a href="#"  onclick="window.open(\[url]http://wahteversite.com/wahtever.php,\start\,\left=200,top=150,height=510,width=595,status\);[/url] return false;"><img  src="/image.jpg" border="0"></a>
    </ul>'

    Any Ideas why i get
    http://wahteversite.com/wahtever.php#

    instead of http://wahteversite.com/wahtever.php

    Thanks in advance
    Excluding the [url] bbc tags

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: # page load

    because you put a hash sign in the href attribute. why else?

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: # page load

    Eww. Just eww.

    echo()ing HTML code; using an event handler attribute; using window.open... I can't see anything good in that code, to be honest, and it's only one line. I shudder to think what the rest of it looks like.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: # page load

    Quote Originally Posted by kows
    because you put a hash sign in the href attribute. why else?
    HUH? Ok now

    Eww. Just eww.
    LOL atleast your honest Penagate

    Is this better?
    PHP Code:
    echo "<a href=\"#\" onclick=\"javascript: window.open('http:mysite.com','start','left=200,top=150,height=510,width=595,status'); return false;\"><img  src=\"/virus.jpg\" border=\"0\"></a></ul>"

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: # page load

    If anything, it looks worse.

    Here is a post by visualAd that explains the basics of code formatting in PHP. Outputting HTML using echo() is inefficient, less readable, and error-prone, as you need to escape various characters.

    Don't open pop-up windows: it's grossly 90s, and will be blocked by just about all modern browsers, leading to a messy, interrupted user experience. In general, don't tamper with browsing models in any way; just use plain links to navigate between pages. If you want to show a pop-up on the page, use Javascript; but be sure to provide a vanilla HTML solution for those without Javascript enabled/supported.


    Edit: Here's a post by yours truly with some more points about why outputting using echo() is bad.
    Last edited by penagate; Feb 3rd, 2007 at 03:06 PM.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: # page load

    Thanks for the reads. I see what your saying.

  7. #7
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: # page load

    you asked why you were getting your URL with a hash at the end of it. "#" is the hash character. you made the href attribute a hash, thus why you're getting the hash character at the end of your URL.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: # page load

    Quote Originally Posted by kows
    you asked why you were getting your URL with a hash at the end of it. "#" is the hash character. you made the href attribute a hash, thus why you're getting the hash character at the end of your URL.
    Nevermind

  9. #9
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: # page load

    Quote Originally Posted by Jazza
    Nevermind
    you are acting like you have absolutly no idea what he is talking about!!

    listen.

    When you put a '#' in the 'href', then it reloads your page with the '#' at the end.

    HTML Code:
    <a href='#'>Link</a>
    if you dont want that to happen, then put the javascript in place of the #
    My usual boring signature: Something

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: # page load

    Like i did in post #4

  11. #11
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: # page load

    Quote Originally Posted by Jazza
    Like i did in post #4
    no..
    My usual boring signature: Something

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: # page load

    I'm lost then. Its working just fine like this.
    Code:
    echo "<a href=\"#\" onclick=\"javascript: window.open('http:mysite.com','start','left=200,top=150,height=510,width=595,status'); return false;\"><img  src=\"/virus.jpg\" border=\"0\"></a></ul>";
    Keep in mind I'm new to all of this as seen above
    http://www.vbforums.com/showthread.php?t=449182
    See i also created the newb thread.

  13. #13
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: # page load

    Quote Originally Posted by Jazza
    I'm lost then. Its working just fine like this.
    Code:
    echo "<a href=\"#\" onclick=\"javascript: window.open('http:mysite.com','start','left=200,top=150,height=510,width=595,status'); return false;\"><img  src=\"/virus.jpg\" border=\"0\"></a></ul>";
    Keep in mind I'm new to all of this as seen above
    http://www.vbforums.com/showthread.php?t=449182
    See i also created the newb thread.
    i can see that you new, you cant even spell n00b!
    My usual boring signature: Something

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: # page load

    See my entire point!!!
    n00b!

  15. #15
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: # page load

    There's no need for that, either of you.


    Jazza: Get rid of all the Javascript. Triggering script from links isn't a great idea at the best of times. Buttons (<button>) are more logical.

    Assign event handlers from your script, which should be in an external .js file. Don't put them inline in the HTML, it's messy.

    Also, href="#" is meaningless. href should always point to a page. If you must trigger script from a link, override the link action from your event handler by using e.preventDefault() (and whatever the IE equivalent is, I forget).


    dclamp: Stop stirring.

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: # page load

    Thanks for the info Penagate.
    I learn something new everytime I come to this board.

  17. #17
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: # page load

    Quote Originally Posted by Jazza
    Thanks for the info Penagate.
    I learn something new everytime I come to this board.
    dont forget! give rep to all who helped, and even thoes who didnt that much

    EDIT:

    also, mark thread as "Resolved"
    My usual boring signature: Something

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    25

    Re: # page load

    Sure thing boss.
    I'll make the thread read "resolved"

Posting Permissions

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



Click Here to Expand Forum to Full Width