Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Feb 2008
    Posts
    74
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Something wrong with this SCR?

    Hi
    this javascript is generated by my code
    Code:
    document.writeln('<head><style>a{color: white; font-size:10px}a:visited{color: white; font-size: 10px;}</style></head><table><tr><tr BACKGROUND="http://localhost:8888/sitewidget/app/webroot/img/border.png"><th><font face="Verdana, Arial" size="4" color="white">Widget</font></th></tr><tr><td><style type="text/css"><!--#frame1 {    width: 400px;    height: 200px;    border: none;    background: white;}--></style><iframe src="/sitewidget/index.php/widget/show/aHR0cDovL3d3dy5iYmMuY28udWsvbG9uZG9uL25ld3Mv/156" name="frame1" id="frame1" scrolling="auto" frameborder="0"></iframe>');</td><tr><tr BACKGROUND="http://localhost:8888/sitewidget/app/webroot/img/border.png"><th><font face="Verdana, Arial" size="20px" color="white" vlink="white"><a href="/sitewidget/index.php/grab/check/aHR0cDovL3d3dy5iYmMuY28udWsvbG9uZG9uL25ld3Mv/156" target="_blank">Get this widget</a></font> <font face="Verdana, Arial" size="2px" color="white"> |</font> <font face="Verdana, Arial" size="20px" color="white" vlink="white"><a href="http://www.websnips.com" target="_blank">Make a widget out of any site</a></font></th></tr></tr></table>'<!-- 0.1254s -->
    I am trying to run it like this
    Code:
    <html>
    <SCRIPT LANGUAGE="JavaScript" SRC="js.html">
    </SCRIPT>
    </html>
    I do not know why it is not running as an external file when it is running when you run the file directly?

    Thanks

  • #2
    New Coder
    Join Date
    Feb 2008
    Posts
    74
    Thanks
    5
    Thanked 0 Times in 0 Posts
    anyone able to help?

    Thanks

  • #3
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    why did you neame it .html?

    You really should be doing this type of things with a serverside language. Disable JavaScript and your page will be rather useless.

    Whwn you open up the page are you getting an error? If you add debugging info into the external file, are you seeing it run?

    Also after that code spits out the text, that is not valid html markup.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #4
    New Coder
    Join Date
    Feb 2008
    Posts
    74
    Thanks
    5
    Thanked 0 Times in 0 Posts
    It works when i run the js file directly it only does not work when i src it. I cannot change it to .js because it is generated by a php file and its path does not even contain .html domain.com/index.php/grab/check/aHR0cDovL2dvb2dsZS5jb20=/40

    Thanks

  • #5
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    If you are generating this with PHP than why in the world are you using JavaScript to output html code? A simple php include line is all you really need.

    Code:
    <?php include("FooFoo.php"); ?>
    If you are trying to just add somthing to the page va a script tag, there are better ways to getting it done than outputting head tags. appendChild come to mind.


    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #6
    New Coder
    Join Date
    Feb 2008
    Posts
    74
    Thanks
    5
    Thanked 0 Times in 0 Posts
    because i dont want to access it from the same domain i am acessing it from another domain, i gather SCR is the only way to do this?

    Thanks


  •  

    Posting Permissions

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