www.webdeveloper.com
Results 1 to 2 of 2

Thread: Strings as Parameters with special characters

  1. #1
    Join Date
    May 2009
    Posts
    13

    Strings as Parameters with special characters

    I'm using a simple function and an anchor tag inside of paragraphs to insert video code and images into locations in web pages.
    Code:
    function insert(s, tag){
            document.getElementById(tag).innerHTML = s;
                                                          
    }
    Code:
    <A HREF="javascript:insert('test123 123', 'test')"> test</a>
    <div id='test'></div>
    I'm not too familiar with javascript and don't know how to handle code for videos. Let me start simple though; I can't print a quotation mark; this won't work:
    Code:
    <A HREF="javascript:insert('\"hello world, look, I'm inside of quotations\" ', 'test')"> test</a>
    <div id='test'></div>
    Ultimately, I'd like to use one function to handle inserting all sorts of video and also diverse code like:
    Code:
    example 1:
    <img src='......
     
    example2:
    <object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/oqI6oOmOyJU&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/oqI6oOmOyJU&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>
    
    example 2)
    <object width="480" height="365"><param name="movie" value="http://www.dailymotion.com/swf/x807h2&related=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/x807h2&related=0" type="application/x-shockwave-flash" width="480" height="365" allowfullscreen="true" allowscriptaccess="always"></embed></object>
    
    example 3)
    <table><tr><td>...

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,354

    Question Just a thought ...

    I'm not sure I understand the problem, so this is just a shot in the dark.

    Can you try this:
    Code:
    <A HREF='javascript:insert(\'"hello world, look, I\'m inside of quotations"\', "test")'> test</a>
    <div id='test'></div>

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