www.webdeveloper.com
Results 1 to 6 of 6

Thread: escape problem

  1. #1
    Join Date
    Mar 2003
    Posts
    21

    escape problem

    Hi,

    I have small problem out here and i guess it is quiet simple.

    <a id="e2" href="/test/09111/520/123.pdf" target="fmContent" class="udrlinesmall" name="Table of Contents" onclick="javascript:jsTitle('Test Manual - What's New in This Guide');">

    jsTitle function needs to sets the page title
    <script>

    function jsTitle(sTitle)
    {
    window.parent.document.title = sTitle;
    }
    </script>

    Here the poblem is that i/p parameter to jsTitle has a single quote,so how do we espace that so that ' appears in the title
    as well as it should not give javascript error.

    One more thing is that i have many hyperlinks in the page
    which can again have the single quote in the title.
    Share on Google+

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    2,653

    Re: escape problem

    Originally posted by sachin
    Hi,
    ('Test Manual - What's New in This Guide');
    replace the above with this

    ('\'Test Manual - What\'s New in This Guide\'')

    EDIT:

    cripes forum editor screwed it up...lol
    Last edited by khalidali63; 05-30-2003 at 06:04 PM.
    Share on Google+

  3. #3
    Join Date
    Mar 2003
    Posts
    21
    thanks dave it works.
    Share on Google+

  4. #4
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Originally posted by Dave Clark
    This will work:

    onclick="javascript:jsTitle('Test Manual - What\\'s New in This Guide');"

    Dave
    That might work, but only because the browser you are using is ignoring the error. But MSIE hasn't taken over yet. That should be:

    onclick="jsTitle('Test Manual - What\\'s New in This Guide');"
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web
    Share on Google+

  5. #5
    Join Date
    Mar 2003
    Posts
    21
    charles,

    i did not get you.
    can pl let me know in detail.
    also why there is a space b/w java & script.
    this is surely not work.

    onclick="java script:jsTitle('Test Manual - What\'s New in This Guide');"
    Share on Google+

  6. #6
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    You will find, if you read through the backlog of postings, that Dave is only really interested in pages working in MSIE. And as far as JavaScript is concerned, there is something to be said for that but there are hundreds of different browsers out there.

    We've had this argument before and yes, my only argument is that it is wrong. Yes it works on most browsers that I know about and it certainly works on most browsers out there, but it's still wrong.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web
    Share on Google+

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles