SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question External loading, MSIE problems

    I have a script that loads in Firefox. But not in IE 6 or 7 beta 3, externaly that is, if I load the script directly it works.

    sample page where the code is suppose to show:
    http://www.freefunnyhumor.com/index2.html

    Script loaded directly
    http://www.thelinkexchanger.com/logi...sid=19&style=0

    IE gives syntax error when not loaded directly. But not at correct line...

    MMORPG Top Site http://topmmorpg.net
    Elite Mafia http://elitemafia.net

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Exactly what script do you mean? There is a lot of scripts on this page. Better to provide code snippet that is failing.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your interest.

    The code on the page that the loads the javascript:
    HTML Code:
    <script language="javascript" type="text/javascript" src="http://www.thelinkexchanger.com/login/blockadexchange.php?category=12&sid=19&style=0"></script>


    The script...
    There is some more PHP coding that comes before, but it does not create any output. As mentioned, it works in Firefox 100%, and in IE when loaded directly.
    HTML Code:
    document.write(<table summary="Ads from the link exchanger" border="0">
    <tr>
    <td height="600">
    <table width="120" border="0" cellpadding="0" cellspacing="0">
    
    <?php
    							 
    //	mysql_query("UPDATE sites SET blockcredit = blockcredit+'$num' WHERE id = '$sid'") or die(mysql_error());
    
    
    // From exchanging members
    while($link = mysql_fetch_array($result)){
    $link_id = $link['id'];
    $link_title = $link['title'];
    $link_url = $link['url'];
    $link_url = str_replace("http://", "", $link_url);
    $link_desc1 = $link['desc1'];
    $link_desc2 = $link['desc2'];
    $link_desc3 = $link['desc3'];
    
    $desc = $link_desc1." ".$link_desc2." ".$link_desc3;
    
    mysql_query("UPDATE blockad SET credits = credits-1, imp = imp+1 WHERE id = '$link_id'") or die(mysql_error());
    
    //$url = "<a href=\"http://www.thelinkexchanger.com/login/gob.php?aid=$link_id&sid=$sid\" title=\"Visit $link_url\" target=\"_blank\" style=\"color : #4242FF; font-size : 9px; font-family : verdana; text-decoration:underline;\">$link_title</a>"; 
    //echo $url;
    //mysql_query("UPDATE blockad SET credits = credits-1 WHERE id = '$link_id'") or die(mysql_error());
    
    
    ?>
    <tr>
    <td>
    		<table width="100%" border="0" cellpadding="4" cellspacing="0" style="border: 1px solid #FF0066;">
    		<tr>
    				<td height="20" align="center" bgcolor="#FFFFE1">
    				<a href="http://www.thelinkexchanger.com/login/gob.php?aid=<? echo $link_id."|".$sid; ?>" title="Visit <? echo $link_url ?>" target="_blank" style="color : #4242FF; font-size : 10px; font-family : verdana; text-decoration:underline;"><? echo $link_title ?></a> 
    			 </td>
    		</tr>
    		<tr>
    				<td height="50" valign="top" bgcolor="#FFFFE1">
    				<span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px;">
    				<? echo $desc; ?></span>
    				</td>
    		</tr>
    		</table>
    </td>
    </tr>
    <?php
    }
    
    // From reserve ads
    while($link_reserve = mysql_fetch_array($reserve_result)){
    $link_id = $link_reserve['id'];
    $link_title = $link_reserve['title'];
    $link_url = $link_reserve['url'];
    $link_url = str_replace("http://", "", $link_url);
    $link_desc1 = $link_reserve['desc1'];
    $link_desc2 = $link_reserve['desc2'];
    $link_desc3 = $link_reserve['desc3'];
    
    $desc = $link_desc1." ".$link_desc2." ".$link_desc3;
    
    mysql_query("UPDATE blockad_reserve SET imp = imp+1 WHERE id = '$link_id'") or die(mysql_error());
    
    //$url = "<a href=\"http://www.thelinkexchanger.com/login/gob.php?aid=$link_id&sid=$sid\" title=\"Visit $link_url\" target=\"_blank\" style=\"color : #4242FF; font-size : 9px; font-family : verdana; text-decoration:underline;\">$link_title</a>"; 
    //echo $url;
    //mysql_query("UPDATE blockad SET credits = credits-1 WHERE id = '$link_id'") or die(mysql_error());
    
    
    ?>
    <tr>
    <td>
    		<table width="100%" border="0" cellpadding="4" cellspacing="0" style="border: 1px solid #FF0066;">
    		<tr>
    				<td height="20" align="center" bgcolor="#FFFFE1">
    				<a href="http://www.thelinkexchanger.com/login/gob.php?aid=<? echo $link_id."|".$sid."|1"; ?>" title="Visit <? echo $link_url ?>" target="_blank" style="color : #4242FF; font-size : 10px; font-family : verdana; text-decoration:underline;"><? echo $link_title ?></a> 
    			 </td>
    		</tr>
    		<tr>
    				<td height="50" valign="top" bgcolor="#FFFFE1">
    				<span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px;">
    				<? echo $desc; ?></span>
    				</td>
    		</tr>
    		</table>
    </td>
    </tr>
    <?php
    }
    
    
    ?>
    
    
    <tr>
    		<td align="center">
    				<table width="100%"  border="0" cellspacing="0" cellpadding="4">
    							 <tr>
    							 <td align="center" height="20">
    							 <a href="http://www.thelinkexchanger.com" title="Visit TheLinkExchanger.com" target="_blank" style="color : #000000; font-size : 9px; font-family : verdana, Times New Roman, Times, serif; font-weight: bold; text-decoration:underline;">Ads by The Link Exchanger</a>
    							 </td>
    							 </tr>
    							 </table>
    				</td></tr></table></td></tr></table>);
    I read somewhere that document.write dont work in xhtml, but I have other ads that loads using document.write
    MMORPG Top Site http://topmmorpg.net
    Elite Mafia http://elitemafia.net

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, document.write method takes a string, meaning
    Code:
    document.write("this is a string");
    and not
    Code:
    // this is NOT a string
    document.write(<table><tr> etc...);
    U know PHP i assume, so then it should be obvious why the document.write is not working

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I adopted the no " from a tutorial site. I have no clue about javascript.

    However, IE still didnt want to load the script. But gave me an error at line 2, char 33, expected ), error 0

    I tried to do document.write each time there was an html output, but all it did was print lots of document.write("");
    MMORPG Top Site http://topmmorpg.net
    Elite Mafia http://elitemafia.net

  6. #6
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Question would also be why you want to put the entire HTML in a JavaScript string, what is the point of that?

  7. #7
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it stops working in firefox if I use single or double quotes....
    MMORPG Top Site http://topmmorpg.net
    Elite Mafia http://elitemafia.net

  8. #8
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it is to be loaded on many websites, like an ad exchange.

    Do you know better methods?
    MMORPG Top Site http://topmmorpg.net
    Elite Mafia http://elitemafia.net

  9. #9
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Think ill place all the hmtl in an iframe. There must be some problems with all the html and perhaps php. I did a test where I only printed out document.write("test"); and it worked.
    MMORPG Top Site http://topmmorpg.net
    Elite Mafia http://elitemafia.net

  10. #10
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's failing because you need to escape the quotes. Lets say you have the following:
    Code:
    <p onmouseover="alert(''hello');"/>
    When you want to make that a String of that using double quotes (") you need to escape the ones in the HMTL using a backslash, like this:
    Code:
    document.write("<p onmouseover=\"alert(''hello');\"/>");


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
  •