Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox continues loading, IE throws error 2

Status
Not open for further replies.

maharg

Technical User
Mar 21, 2002
184
Hi

I am struggling to find an error in my simple script.
The script works as intended in Firefox 3.6.4 , but the tab always says "loading"

In IE8 I get a permissions error, and no result.

I've spent 2 days tryng to isolate the bug, and would be really grateful if someone could show me where I'm being stupid!

See
Many thanks,

Graham
 
looking at the markup I would say this is a problem
Code:
<select name="..." size="...">
<option>Red
<option>Green
<option>Yellow
<option>Alternating
<option>Random
you are not closing the tags. it should be
Code:
<select name="..." size="...">
   <option>Red</option>
   <option>Green</option>
   <option>Yellow</option>
   <option>Alternating</option>
   <option>Random</option>
</select>

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Hi Jason,

Many thanks, no, unfortunately that's not it.

I've closed the tags now, but still the same code error.

All the best,

Graham
 
>The script works as intended in Firefox 3.6.4 , but the tab always says "loading"
[tt]
//////////////////////////////////////////////////
// Start to write the document
//////////////////////////////////////////////////
[red]document.open();[/red]
document.write("<html><head><style type=\'text/css\' media=\'all\'>@import \'lel.css\';</style></head><body><h1>Titan matrix creator</h1><br><br><table border=12 bordercolor=black cellpadding=0 cellspacing=0 rules=none frame=box>");

[blue]// etc etc [/blue]

/////////////////////////////////////////////////
// Now close the HTML document
//////////////////////////////////////////////////
document.write("</table>");
document.write("<br><br><input type=\'button\' value=\'Back\' onClick=\'history.go(-1)\'></body></html>");
[red]document.close();[/red]
[/tt]
But, I must say, that is the kind of thing that make people very uneasy. As an exercise, I guess it is okay.
 
it also may be that you are escaping the single quotes within a double quoted string. you only need to escape characters when the quotes are the same.
examples
Code:
document.write("double \" quote")
document.write('double " quote')
document.write('single \' quote')
document.write("single ' quote")
echoing tsuji. document.write is usually a sign there is a better way to generate the html. I'm not a css guru, but you should be able to build the image using css sprites within a div (not table required).

the concept works like this:
1. create a single css image containing the black background and a single colored "light"
2. depending on the width and height selected by the user set the width and height of the div tag. the background is set to to the selected image and repeated vertically and horizontally.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Hi Folks,

Still no joy, I've done all recommendations, except the css, as it should work with html, but will look at css once the bug has been found.

Will not write in IE, beyond the 1st <tr> tag.

The updated version with your recommendations is now available on my original link.

Thanks

Graham
 
>The script works as intended in Firefox 3.6.4 , but the tab always says "loading"
My post above is based on this statement that the script works as intended in firefox, if it is not working at that level, .open() and .close() will not help.
I visit the page with Firefox. I cannot confirm it is working though. I may miss something on what to do with the page. But, I won't insist.
 
Hi tsuji,

Thank you, the Firefox is working OK now.

But still no result in IE.

There is no output at all.

Regards,

Graham
 
Since you mention something related to "input", I would say when you script the select element, you've to put the value attribute to the options, even if you're intended to be the same as the "text" of it. Using text as a proxy for value would not work cross-browser. I mean this.

><option>Red</option>
[tt]<option [red]value="Red"[/red]>Red</option>[/tt]

etc...
 
Hi tsuji,

Not that - thanks for all your suggestions, though:)

The problem now is only in IE.

Regards

Graham
 
>Not that...
Ok. I look a bit into your page source. You use everywhere client-side selectedIndex only, hence, no, it won't help you that way with proper value attribute.

Here is what you've to do with the script.
[1] Put a string variable anywhere above the occurence of document.open().
[tt] var s="";[/tt]
[2] Comment out document.open() and document.close() at their present location.
[3] Replace all document.write(...) by simply building the s instead.
[tt] [red]//[/red]document.write("some string");
s+="some string";[/tt]
[4] [highlight]At the end[/highlight] of the function, do all the document building
[tt] document.open();
document.write(s);
document.close();[/tt]
 
another option... use jquery to reference the DOM, get the values, build the result and append to the DOM. there are still too many nuancies with javascript and browsers to write raw javascript. a library like jquery will abstract the browser differences for you.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Excellent, thank you tsuji!
Now working in IE8

Jason, I will heed your suggestion also, many thanks indeed!

Regards

Graham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top