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
12 1835
The src needs to be for a JavaScript file, not an HTML one.
The attribute language is deprecated - set the type attribute instead to "text/javascript".
The HTML document should have a body and a valid doctype.
Not all of these should be the cause, but it's good practice anyway.
The src needs to be for a JavaScript file, not an HTML one.
The attribute language is deprecated - set the type attribute instead to "text/javascript".
The HTML document should have a body and a valid doctype.
Not all of these should be the cause, but it's good practice anyway.
I thought the file i am trying to src was javascript, how do i change this to javascript?
Thanks
Change the extension to .js.
The script shouldn't really be writing the head content too. Try putting the head section in the HTML page and use the file to write the body content.
In the header tag of the html file include this peice of code - <head><script type="text/javascript"
-
src="Relative path where your file is located from the current directory"></script></head>
Now change the extension properly from .html to .js be carefull while changing the extension sometimes in windows if you will change the extension like in this case the most generic error is, it will show the file.js on screen but actually it will be file.js.html.
In the header tag of the html file include this peice of code - <head><script type="text/javascript"
-
src="Relative path where your file is located from the current directory"></script></head>
Now change the extension properly from .html to .js be carefull while changing the extension sometimes in windows if you will change the extension like in this case the most generic error is, it will show the file.js on screen but actually it will be file.js.html.
Thanks, the only problem with this is that it is infact an automated html page i changed the parameters to make it js. Also i was only using the path to the file as an example the actual path has no .extention is more like http://doman.comindex.php/grab/check/aHR0cDovL2dvb2dsZS5jb20=/40 with no html or js extension. Can i work with this without majorly edditing the php side of things which would be a major upheaval?
send a javascript header in the returning file.
[PHP]// in php you'd write on top
header("content-type: text/javascript");[/PHP]
regards
send a javascript header in the returning file.
[PHP]// in php you'd write on top
header("content-type: text/javascript");[/PHP]
regards
this shouldn't matter. the .src of a script tag can be any mimetype, any extention, etc.
it just has to actually be javascript to work. i serve all my .js files as HTML, which lets me view and edit them in browser. i have only seen one compatibility problem with an old version of opera in XHTML strict, but it works with recent releases.
That's true, though, to avoid confusion, I'd avoid the .html extension unless it's obvious that it's a js file (with proper naming).
ojsimon, give an example of generated JavaScript which doesn't work.
i did post an example its the very first code section on my first post of this thread.
Thanks
Is there no chance you could add line breaks to your code using separate document.writeln() statements for each line? Though it shouldn't make much difference, you're missing <body> tags.
Is there no chance you could add line breaks to your code using separate document.writeln() statements for each line? Though it shouldn't make much difference, you're missing <body> tags.
no it didnt make much difference but thanks, anyone else?
Thanks
When you load the page, are there any errors?
If possible, what you should do is only write the body content, at least for validation purposes. So, in your HTML file, have the head content in the file together with a body tag and then within the body tag load the JavaScript file: - <html>
-
<head>
-
...
-
</head>
-
<body>
-
<script type="text/javascript" src="somefile.php"></script>
-
</body>
-
</html>
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Major Man |
last post by:
Hi,
I run 2 websites, on 2 different domains/servers.
I need a php script on server A, which when run will go to server B
at (ex. http://serverB.com/images/counter.gif) and load that image 6...
|
by: pealy2 |
last post by:
A quick pointer to anyone struggling with the RegisterClientScriptBlock
function, unless you already have a <FORM> section in your page then
the script will not be added.
I use vb code to...
|
by: huyuhui |
last post by:
The following is a question of LOAD utility.
Question:
How does the DB2 enforce table check constraints for data added to
table with the LOAD utility?
A. With the BUILD phase of LOAD
B. With the...
|
by: jonathan184 |
last post by:
Basically i am trying to make a config file
which will contain to sets of paths
for e.g - this file is called config.pl
#!/usr/bin/perl
#Path1
$sourcedir1 = '/home/test/srcdir1';
|
by: jonathan184 |
last post by:
Hi I have a perl script, basically what it is suppose to do is check a folder with files. Now the files are checked using a timestamp with the command ls -l so the timestamp in this format is...
|
by: Mufasa |
last post by:
Does anybody have any experience with a tree view control for winforms that
will automatically load on demand (I could write it myself but why bother.)
Just wondering which, if any of them, are...
|
by: perhapscwk |
last post by:
Table below
id parent_id Node
1 0 Node 1
2 0 Node 2
3 1 Node 1.1
4 1 Node 1.2
5 2 Node 2.1
write a class that will load the tree from the table using below function
|
by: jamwil |
last post by:
What's up guys. I'm having some issues... I've created a method as part of my lifestreaming class which takes an rss feed, and puts the data into a database... It's fairly simple... Check...
|
by: never2lite |
last post by:
Before this evening when I came home and found an odd page showing on my desktop, my pc ran okay...not great. It is a new emachine, only purchased it in 5/2010, but there have been issues with it. I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |