...

View Full Version : Something wrong with this SCR?



ojsimon
10-12-2008, 07:49 PM
Hi
this javascript is generated by my 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

<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

ojsimon
10-13-2008, 05:39 PM
anyone able to help?

Thanks

A1ien51
10-13-2008, 05:58 PM
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

ojsimon
10-13-2008, 06:18 PM
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

A1ien51
10-13-2008, 06:25 PM
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.



<?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

ojsimon
10-13-2008, 06:45 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum