www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] Problem with document.write

  1. #1
    Join Date
    Mar 2008
    Posts
    3

    resolved [RESOLVED] Problem with document.write

    Hi all,

    I'm working on an internal site for my company and I have a snippet of code that works 100% fine indepentantly but when I try to use document.write I can get it to work. I'm pretty sure it's down to the structure of it but I'm inexperienced with JS so I'm not sure how do correctly structure it.

    Here is the code I want inside of a document.write():

    Code:
    <a href='javascript: void(0);' style="text-decoration:none; font-size:14px;" onclick="
    document.getElementById('my_hidden_div_id_1').innerHTML = '<iframe src=\'{file:link}\' width=\'880\' height=\'500\'></iframe>'
    $('#my_hidden_div_id_1').koverlay({title: '{file:filename}'});
    $('.css_koverlay').css({'background-color':'#9c183a'});
    ;
    ">
    Could anyone help me correctly code it so that it outputs without errors?

    Thanks!

  2. #2
    Join Date
    Mar 2008
    Posts
    3
    I missed a little from the code snipped. Here it correctly this time. As an example I have put it inside a document.write(). I know some of the characters need to be escaped, but that is where some of my trouble lies I think, whatever I try it still gives errors.

    Code:
    document.write ("<a href='javascript: void(0);' style="text-decoration:none; font-size:14px;" onclick="
    document.getElementById('my_hidden_div_id_1').innerHTML = '<iframe src=\'{file:link}\' width=\'880\' height=\'500\'></iframe>'
    $('#my_hidden_div_id_1').koverlay({title: '{file:filename}'});
    $('.css_koverlay').css({'background-color':'#9c183a'});
    ;
    ">
    Pop-Up</a>")

  3. #3
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    document.write ('<a href="javascript: void(0);" style="text-decoration:none; font-size:14px;" onclick="document.getElementById(\'my_hidden_div_id_1\').innerHTML = \'<iframe src=&quot;{file:link}&quot; width=&quot;880&quot; height=&quot;500&quot;></iframe>\'; $(\'#my_hidden_div_id_1\').koverlay({title: \'{file:filename}\'}); $(\'.css_koverlay\').css({\'background-color\':\'#9c183a\'});">Pop-Up</a>');

  4. #4
    Join Date
    Mar 2008
    Posts
    3
    Thanks Fang, thats worked brilliantly!

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