SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Please help me get URL using getAttribute for IE

    Sorry for my English

    FireFox is ok
    but IE, link "#top" = current url + #top
    Attached Files Attached Files

  2. #2
    Trash Boat mkoenig's Avatar
    Join Date
    Aug 2007
    Posts
    1,232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This solution requires php? But you can echo php variables in javascript.

    PHP Code:
    <?php
    $url 
    $_SERVER["PHP_SELF"] ;
    ?>
    Code:
    <script language="Javascript">
    <!--
    alert ("<? echo $url; ?>")
    //-->
    </script>

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using javascript, not use PHP

  4. #4
    Trash Boat mkoenig's Avatar
    Join Date
    Aug 2007
    Posts
    1,232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats what i was saying.

    You don't have php installed on your server?

  5. #5
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i want to get text in href='"xxxxxxx" using Javascript (i using getAttribute)
    With href = "#xxx"
    FireFox, results is:#xxx
    But IE. results is: current url + #xxx

  6. #6
    Trash Boat mkoenig's Avatar
    Join Date
    Aug 2007
    Posts
    1,232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok man. Maybe someone else can do it for you. Just trying to help.

  7. #7
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    So just do a split on the # and get the second entry from the resultant array and add the # back onto the front of that.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •