SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript problem

    Why doesn't this javascript function work to display this:

    PHP Code:
    <script language="JavaScript"> var strCode '';</script>
    <script src="http://www.test.com/webmaster/newsbox/webmaster.php?target=&prefiximage=&prefix=on&style=&color=%23000000&font=Verdana&size=0&top=17&category=1&ReturnAs=html"></script>
    <script language="JavaScript">document.write(strCode);</script> 
    Can you see any problems with the javascript "code"?

  2. #2
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you elaborate on what you are trying to do?
    intragenesis, llc professional web & graphic design

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.otmmedia.com/webmaster/ne...&ReturnAs=html
    <--- that is the real address -

    PHP Code:
    <script language="JavaScript"> var strCode '';</script> <script src="http://www.otmmedia.com/webmaster/newsbox/webmaster.php?target=&prefiximage=&prefix=on&style=&color=%23000000&font=Verdana&size=0&top=17&category=1&ReturnAs=html"></script> <script language="JavaScript">document.write(strCode);</script> 
    What i'm trying to do is to display the content there without the need of iframe, so that you can put that code on other websites and it will display the content... Understand?

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The language attribute is invalid and you're missing the required type attribute from all three scripts. (It should be type="text/javascript".)

    You also have a whole bunch of unencoded ampersands in the URI of the second script. Each one needs to be replaced by &#38;amp;.

    I'm still not sure what you're trying to achieve. Are you attempting to include one page into another using <script> tags? That won't work.

    What you're doing is this:
    1. Declare an empty variable named strCode.
    2. Call an external script that isn't a script, but an HTML document. The JavaScript interpreter will choke on this step.
    3. Insert the previously declared empty variable into the output stream.
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it works now Just missed some tags :P sorry..

    Feel free to try it

    PHP Code:
    <script language="JavaScript"> var strCode '';</script> 
    <script src="http://www.otmmedia.com/webmaster/newsbox/webmaster.php?target=&prefiximage=&prefix=on&style=&color=%23000000&font=Verdana&size=0&top=17&category=1&ReturnAs=html"></script> 
    <script language="JavaScript">document.write(strCode);</script> 


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
  •