Can you post some code?
Not sure if a background image on the link will fix your problem OR one of a "title" or "alt" attributes on one of the elements you are doing. Hard to troubleshoot without knowing what you are looking at.
hielo 65 Veteran Poster
>>Firefox = doesn't resize the iframe at all
This is not true, it does. At least it does in mine, but it changes only by a few pixels (10 or 15 maybe) that it is hardly noticeable.
The only way to know if the javascript function is truly working is if you alter your code as follows:
the_height=elem.contentWindow.document.body.scrollHeight;
alert(the_height);
if the reported height is significant (more than 10 or 15) then the problem is else where. I copied you index.html page, and after viewing it via FF, what you have does work as in IE. Meaning it resizes appropriately, not just an insignificant 10 or 15 pixels. However, on my copy of your test page, I am not importing your css file anywhere:
<link rel="stylesheet" href="css/3col_leftNav.css" type="text/css" />
Repeat: I did not use/copy that css file at all AND the code works as expected. Hence, I thought I should begin looking there. I don't know what those css definitions are doing but after copying the file and adjusting the <link href=""> to point to my copy of your CSS file only on index.html, I noticed that it worked as expected on both IE and FF.
I then adjusted the CSS path (<link href="">) on the iframe target pages (home.html, etc), and wham. Problem replicated.
Solution: on the iframe pages, do not import the css file. Since index.html already does so, the css style definitions should propogate to your iframe files since they are all …
hielo 65 Veteran Poster
Open the properties window for the website in question ( the fifth image from top to bottom on the step-by-step tutorial at http://www.razorx.com/tutorials/IISonXPPro/).
Then click on the "Home Directory" tab. Make sure that "Execute Permissions" is set to "Scripts Only" at the very least.
If after this, the problem persists, on that same tab, click on the "Configuration" button.
Then on the pop-up window you will see three tabs. You need the one labeled "Mappings". Make sure that under "Application Mappings" you have ".asp" listed in extensions. If it is not there then it was not registered properly when you installed IIS. So you would need to re-install IIS.
hielo 65 Veteran Poster
Read post #18 here. That is the solution to these problems.
>>so it seems we need to revisit the following:
setInterval("alterText();", 110);
The problem is NOT how often you call alterText(). The problem is that at some point, alterText executes:
document.getElementById("n"+letter).style.visibility="visible";
where
document.getElementById("n"+letter) is evaluated first. For a value of letter whereby there is a non-existent id, null is returned. So basically at the end, you are trying to set the style property on a null object. Hence the error.
Again, post #18 on this thread addresses this issue.
hielo 65 Veteran Poster
My comments are in the code:
var frame=0;
var interval=null;
var http = createRequestObject();
function createRequestObject(){
var request_=null;
//not necessary
//var browser = navigator.appName;
if(window.XMLHttpRequest)
{
request_ = new XMLHttpRequest();
}
else if(window.ActiveXObject){
request_ = new ActiveXObject("Microsoft.XMLHTTP");
}
return request_;
}
function getInfo(){
if( http )
{
//first parameter MUST BE UPPERCASE
http.open('GET', 'GtCht.php');
http.onreadystatechange = handleInfo;
http.send(null);
++frame;
if(frame < 24 )
{
clearInterval(interval);
}
}
else
{
alert("Your browser does not support AJAX.");
}
}
function handleInfo(){
//must make sure you optained the resource successfully
if(http.readyState == 4 && http.status==200){
var response = http.responseText;
document.getElementById('ChtPlc').innerHTML= document.getElementById('ChtPlc').innerHTML + response;
}
}
function GetINF(){
interval = setInterval(getInfo(),1000)
}
hielo 65 Veteran Poster
Thanks, Hielo.. I did tinker with firebug last night, after fixing a few things, but could not find where the errors would be displayed.
Once firebug is installed, you will see a little icon on the lower right-hand side of your browser. The icon will be a small check mark on a green background if there are no reported errors on the page, or an x on a red background if errors exist. However, you still need to configure it for it to show the "x" icon upon javascript errors. To do so, click on the icon > options > Show Javascript Errors
I'm kind of in the dark as to the cover (URI) page, tho I suspect it may be something to do with running these functions concurrently:
setInterval("alterText();", 110); setInterval("alter();", 100); setInterval("alter();", 100);
When I looked at this page, nothing had changed. You were not checking for the limit (23).
Actually, I counted 24 letters in liste v nligh v tpoet v ryjou v rnal iv
Yes, this is correct. But you began numbering the letters at 0. So, the 24th letter will have id "n23". So, when you add a limit check to it, you cannot exceed 23. Refer to my previous post to see how I addressed this issue on the other page.
-- & since, to my knowledge, employing Math.floor() requires it, I changed the delimiting constant herewith from 24 to 25:
Math.random() by itself will give you a floating number …
hielo 65 Veteran Poster
Try this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled</title>
<script type="text/javascript"><!--
function sendIt(formElem)
{
if (event.keyCode==13 )
{
formElem.submit();
return true;
}
return false;
}
//--></script>
</head>
<body>
<form action="http://www.somesite.com" onkeypress="sendIt(this)">
<textarea rows="10" cols="70"></textarea>
</form>
</body>
</html>
hielo 65 Veteran Poster
Wait a minute, I take that back. I left IE open long enough for the letter to reach the limit (3450), and then I got a pop-up error. The same with FF.
The reason for that is that when letter = 3449,
else if( letter < 3450 ){...}
is true and the content inside {...} is executed. That contents increments letter to 3450. So the next time that timeout calls alterText(), it attempts to execute this first:
underscore = document.getElementById("n" + letter).innerHTML;
since letter is now 3450 an such id does not exist, it throws a runtime error! You must check for the limit first.
Here's the revised code:
function alterText()
{
if(letter < 3450)
{
underscore = document.getElementById("n" + letter).innerHTML;
if(underscore == "_")
{
document.getElementById("n" + letter).innerHTML=" ";
}
else
{
document.getElementById("n" + letter).style.visibility="visible";
document.getElementById("n" + letter++).style.color=genHex();
}
return true;
}
return false;
}
hielo 65 Veteran Poster
I looked at http://listenlight.net/13/iijima/ with FF and IE and they behave as shown on the video. Furthermore, my FF debugger is not triggerring any errors.
However, the homepage:
http://listenlight.net/
still does.
hielo 65 Veteran Poster
>> all I need to do for IE at this point is limit the calls to defined id attributes?
Yes
>> I should look at the source of each page, and stop the text engine after it renders the final character on the page?
Not necessarily. I don't know what is your desired effect. If you just want changing colors while loading then the answer is YES.
[This is what I did on post #2 above]
Otherwise, once the 23 character is loaded you just need to reset the variable letter to 0. This will cause the page to continuously re-render the entire string with changing colors.
[This is what I did on post #5 above.]
Both of those posts are complete code that you can simply copy from the posts, save them to your system, and then just run them. Both worked fine for me on FF and IE.
BTW: Try installing the Firebug extenstion for FireFox. Then open your page current page and you will see how the errors just keep accummulating.
tefflox commented: good help +2
hielo 65 Veteran Poster
>>if you go back to alterText, you would realize that there are at most 23 letters. Hence you should not call alterText more than 23 times
because there is no letter with id 24. The largest you have is "L23".
Actually there are 24 letters on "listenlightpoetryjournal", but since you enclosed each of them in a span and the id's were enumerated starting with 0, the last letter has id="n23"
From your original code:
document.getElementById(letter++).style.color=genHex();
this would be problematic when letter increases beyond 23 because there is no (for example):
<span id="n24">?</span> where "?" could be any letter. letter is increased only once when the function alterText() is called, but the real problem is that your code never stopped calling alterText(). This is because setInterval() acts like an alarm clock. The first argument would be sort of the beep/tune that the clock will play, and the second argument would be time between beeps. If you don't shut off the alarm button, the alarm will go on forever [ assuming an atomic powered clock :) ]. This same principle is taking place here. The other two paragraps following the one I just explain basically describe how to shut-off the alarm clock
>>window.onload=function(){
timer[0]=setInterval("alterText();", 110);
timer[1]=setInterval("alter();", 100);
timer[3]=setInterval("alter();", 100);
}
In HTML you could do something like:
<body onload="beginProcess()">
You can avoid adding that to your HTML markup by doing the following:
function beginProcess()
{
…
hielo 65 Veteran Poster
What you need is a popup div. Within the div you would need to insert <img> elements. Below are two resources with that show how to implement this. You only need to add the image element to it.
hielo 65 Veteran Poster
>>However, you make various assumptions that I don't appreciate.
My apologies if I offended you. I was just trying be be as thorough as possible just for the sake of clarity. It was not my intention to sound condescending.
>>To my knowledge, also, var++ employs the current value of var, and then increments it before moving on.
This is exactly right. However on your original code you need to reset the "letter" variable after it reaches 23. That's why on my last post, I removed the letter++ from within the parenthesis and then added the following:
letter = ++letter%24;
hielo 65 Veteran Poster
Since you asked, you are probably interested (as oppoed to just curious) about the subject. Here are some resources on the subject [You don't have to read them all at once :) ]
http://www.oreillynet.com/pub/a/network/2000/04/14/doctype/index.html
http://www.456bereastreet.com/archive/200609/no_more_transitional_doctypes_please/
http://www.quirksmode.org/css/quirksmode.html
http://developer.mozilla.org/en/docs/Gecko%27s_%22Almost_Standards%22_Mode
http://www.zvon.org/xxl/xhtmlReference/Output/comparison.html
http://www.blackwidows.co.uk/resources/tutorials/xhtml/attribute-comparison.php
http://www.456bereastreet.com/archive/200606/why_is_the_style_attribute_allowed_in_strict_doctypes/
hielo 65 Veteran Poster
BTW: I did try your code with two local files and it worked for me on both. That's why I am convince the issue is your invalid markup. Make sure your markup is correct on all pages, not just the one containing the iframe.
hielo 65 Veteran Poster
Most likely FF is just not forgiving you for your careless Markup. For example:
<a href="pages/home.html" target="the_iframe">Home</a >
<a href="pages/team.html"aboutus.html" target="the_iframe">The Team</a>
<a href="pages/Projects.html"projects.html" target="the_iframe">Projects</a>
<a href="pages/services.html" target="the_iframe">Services</a>
<a href="pages/Contact.html" target="the_iframe">Contact Us</a>
Pay close attention to the href value on "The Team" and "Projects". You have two web addresses back to back AND incorrectly enclosed.
My recommendation: You need to start getting into the habit if using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
and validate your markup on w3c's validator. If you are doing things right, it should report no errors on your markup. Basically, if no errors are reported there is very little chance that you will "confuse" any standards compliant browser.
hielo 65 Veteran Poster
Here is your updated ORIGINAL code, if you are interested in the infinite color-changing effect:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="listenlight poetry journal" />
<meta name="keywords" content="poetry" />
<title>listenlight poetry journal</title>
<style type="text/css">
body {
background-image: url('/13/default.png');
background-repeat: repeat; font-size: x-large;
font-weight: bold;font-family: Tahoma, Geneva, Sans-Serif;
letter-spacing: 3px;
line-height: 1.2;
}
#banner {
position: absolute; bottom: 55%; left: 1%; right: 1%;
text-align: center;
font-family: Tahoma, Geneva, Sans-Serif;
letter-spacing: 10px;
}
a.firefox:link {color: skyblue; text-decoration: none; outline: none; cursor: default;}
a.firefox:visited {color: skyblue; text-decoration: none; outline: none; cursor: default;}
a.firefox:active {color: skyblue; text-decoration: none; outline: none; cursor: default;}
a.firefox:hover {color: darkblue; background-color: skyblue; text-decoration: none; outline: none; cursor: default;}
a.archives:link {
color: pink; text-decoration: none; outline: none; opacity: 0.3;
font-size: 80%; font-weight: bold; font-family: Tahoma, Geneva, sans-serif;
}
a.archives:visited {
color: pink; text-decoration: none; outline: none; opacity: 0.3;
font-size: 80%; font-weight: bold; font-family: Tahoma, Geneva, sans-serif;
}
a.archives:active {
color: pink; text-decoration: none; outline: none; opacity: 0.3;
font-size: 80%; font-weight: bold; font-family: Tahoma, Geneva, sans-serif;
}
a.archives:hover {
color: black; text-decoration: none; outline: none; opacity: 0.3; font-variant: small-caps;
font-size: 70%; letter-spacing: 15px; background-color: pink; font-weight: bold; font-family: Tahoma, Geneva, sans-serif;
}
</style>
<script type="text/javascript">
colors = new Array(14)
colors[0]="0"
colors[1]="1"
colors[2]="2"
colors[3]="3"
colors[4]="4"
colors[5]="5"
colors[5]="6"
colors[6]="7"
colors[7]="8"
colors[8]="9"
colors[9]="a"
colors[10]="b"
colors[11]="c"
colors[12]="d"
colors[13]="e"
colors[14]="f"
function genTextHex(){
colorStart="#"
for (j = 0; j == 0; j++){
color = colors[6 + Math.floor(Math.random() * …
hielo 65 Veteran Poster
>>there are only two possibilities in my case
This is OK, but you could rename:
function imagexists
to something more generic like:
function fileIsAvailable
and be able to reuse the function on other projects. 200 => true: Server is willing to give you the file. 404 => false: File truly does not exist.
anything else => null: You (the developer) need to look into this matter (Permission problem?, redirecting resource?,internal server error?)
Just a suggestion.
hielo 65 Veteran Poster
/*
colors is just a list of the possible hexadecimal representation of the color values.
Basically all you have here is a look-up table.
*/
colors = new Array(14)
colors[0]="0"
colors[1]="1"
colors[2]="2"
colors[3]="3"
colors[4]="4"
colors[5]="5"
colors[5]="6"
colors[6]="7"
colors[7]="8"
colors[8]="9"
colors[9]="a"
colors[10]="b"
colors[11]="c"
colors[12]="d"
colors[13]="e"
colors[14]="f"
/*
after this comment, you just encountered your first function definition. It has not been called
yet, but when it does:
this function will generate a random color code. Any single "digit" will be at least 6 and
at most d.
For example:
#7689da;
The only error here is that trailing semicolon. Why? because later on you are assigning
that color to a particular letter, but when you assign these css values via javascript,
they may not contain the ending semicolon. The semicolon is required only in css stylesheets
or <style type="text/css">...</style> blocks to delimit one property from the other. Since in
javascript you can only set/specify one property at a time, there is no need for the trailing
semicolon. As a result, you will get runtime errors because it is an unexpected character on the
property value.
*/
function genTextHex(){
colorStart="#"
for (j = 0; j == 0; j++){
color = colors[6 + Math.floor(Math.random() * 7)]
+ colors[6 + Math.floor(Math.random() * 7)]
+ colors[6 + Math.floor(Math.random() * 7)]
+ ";";
}
return colorStart + color;
}
/*
after this comment, you encounter your second function definition. It has not been called yet
either, but when it does:
Like the previous function this also …
hielo 65 Veteran Poster
This:
var a = document.createElement('<div id="a' + appInc + '">');
is a Microsoft weirdness. The correct way to do it crossbrowser is exactly like you have it in your else case. The create element is supposed to receive only the name of the tag ("div") not an HTML string ("<div id=''>").
An alternative (shorter form) to the else case is as follows:
var a = document.createElement('div');
a.id="a" + appInc;
hielo 65 Veteran Poster
I don't know what you mean by "...I pasted...". The code I supplied was a complete file by itself. Basically you were supposed to save it as a file by itself and see if it does what you want. If so, you to analyze what I did and extract what you need from it (be it code or idea) and apply it to your own page.
I cannot tell why your page is not working because I don't know what your HTML code looks like. CSS only makes sense if you have the HTML structure to look at. That's why I gave you a complete page. You can save what I gave you as hielo.html and and use that as a starting point for a new version of your file. Just add the content incrementally and keep testing the page as you add CSS and/or Javascript to it to make sure that whay you recently added does not break it.
Lastly, the only thing I can think of for which your page is "blank" is because on every one of your javascript functions I saw references to "sub_menu_bg" as in the following:
//var id_ul=document.getElementById("sub_menu_bg");
//id_ul.style.backgroundColor='#0199DC';
but if you notice carefully, I commented them all out. The reason for this is that I could not find any html element with id="sub_menu_bg". Hence, that line was giving errors all over the place. If your file has that id defined somewhere, you need to make the necessary adjustments …
hielo 65 Veteran Poster
It's possible that browser is unable to "import" all/any/some of the javascript files. If I were you I would:
a. install Firefox
b. install Webdeveloper Toolbar extension/add-on
c. install Firebug extension
d. Restart Firefox
e. Open the page in question
f. On the Webdeveloper Toolbar click on Information > View Javascript
Make sure you see all the expected javascript files. You will be able to tell very clearly if any of them is missing.
g. IF all the files are there, on the lower right-hand side of the screen you will see a little firebug. Click on it and report here what error details it gives you.
hielo 65 Veteran Poster
No, it does not really work on FF either. There are tons of errors getting triggered and never stopping. These are all because you are not clearing the timeouts you are setting. Since the phrase contains 23 letters, you are not supposed to stop calling the timeout functions after letter 23. These should work across browsers.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="listenlight poetry journal" />
<meta name="keywords" content="poetry" />
<title>listenlight poetry journal</title>
<style type="text/css">
body {
background-image: url('/13/default.png');
background-repeat: repeat; font-size: x-large;
font-weight: bold;font-family: Tahoma, Geneva, Sans-Serif;
letter-spacing: 3px;
line-height: 1.2;
}
#banner {
position: absolute; bottom: 55%; left: 1%; right: 1%;
text-align: center;
font-family: Tahoma, Geneva, Sans-Serif;
letter-spacing: 10px;
}
a.firefox:link {color: skyblue; text-decoration: none; outline: none; cursor: default;}
a.firefox:visited {color: skyblue; text-decoration: none; outline: none; cursor: default;}
a.firefox:active {color: skyblue; text-decoration: none; outline: none; cursor: default;}
a.firefox:hover {color: darkblue; background-color: skyblue; text-decoration: none; outline: none; cursor: default;}
a.archives:link {
color: pink; text-decoration: none; outline: none; opacity: 0.3;
font-size: 80%; font-weight: bold; font-family: Tahoma, Geneva, sans-serif;
}
a.archives:visited {
color: pink; text-decoration: none; outline: none; opacity: 0.3;
font-size: 80%; font-weight: bold; font-family: Tahoma, Geneva, sans-serif;
}
a.archives:active {
color: pink; text-decoration: none; outline: none; opacity: 0.3;
font-size: 80%; font-weight: bold; font-family: Tahoma, Geneva, sans-serif;
}
a.archives:hover {
color: black; text-decoration: none; outline: none; opacity: 0.3; font-variant: small-caps;
font-size: 70%; letter-spacing: 15px; background-color: pink; font-weight: bold; font-family: Tahoma, Geneva, sans-serif; …
hielo 65 Veteran Poster
Here's another possibility. I think it is self explanatory.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript"><!--
function popup(pg){
window.open(pg,"thumbnail");
}
//cache some of the images
var picture=[];
//picture 1
picture[ picture.length] = new Image(100,25);
picture[ picture.length-1].src="http://tbn0.google.com/images?q=tbn:CEJ6v_RioxskhM:http://www.cs.indiana.edu/hyplan/kinzler/pubs/pvfigs/31.gif";
//picture 2
picture[ picture.length] = new Image(100,25);
picture[ picture.length-1].src="http://tbn0.google.com/images?q=tbn:YgyENENqo-IHsM:http://www.boutell.com/baklava/sconeApplet/start.gif";
//--></script>
</head>
<body>
<!-- load the first two images cached and call the popup after the second image finishes loading -->
<img src="http://tbn0.google.com/images?q=tbn:CEJ6v_RioxskhM:http://www.cs.indiana.edu/hyplan/kinzler/pubs/pvfigs/31.gif" alt="http://tbn0.google.com/images?q=tbn:CEJ6v_RioxskhM:http://www.cs.indiana.edu/hyplan/kinzler/pubs/pvfigs/31.gif">
<img src="http://tbn0.google.com/images?q=tbn:YgyENENqo-IHsM:http://www.boutell.com/baklava/sconeApplet/start.gif" onload="popup(this.src)" alt="http://tbn0.google.com/images?q=tbn:YgyENENqo-IHsM:http://www.boutell.com/baklava/sconeApplet/start.gif">
<script type="text/javascript"><!--
//cache the rest of the images
//picture 3
picture[ picture.length] = new Image(100,25);
picture[ picture.length-1].src="http://tbn0.google.com/images?q=tbn:gPqvrBkrx3DwDM:http://blogoscoped.com/files/google-com-history/thumb/1997.jpg";
//picture N
picture[ picture.length] = new Image(100,25);
picture[ picture.length-1].src="http://tbn0.google.com/images?q=tbn:aZYOvBjNyse0IM:http://my.opera.com/ThePast/homes/files/google%2520com%2520tianmen.png";
//--></script>
<img src="http://tbn0.google.com/images?q=tbn:gPqvrBkrx3DwDM:http://blogoscoped.com/files/google-com-history/thumb/1997.jpg" alt="">
</body>
</html>
hielo 65 Veteran Poster
It sounds like you are using an automatic pop-up that gets triggered AFTER all the thumbnails are loaded. It that is the case, then perhaps you should consider calling the popup after the first or second or third etc., image is loaded instead of waiting for all of them to load. IF you choose to call the popup after image 3 is loaded, you just need to set an onload event handler on that image so that the popup loads. EX:
<img src="image.gif" onload="popup(this.src)"/>
would call your function popup, passing it the value of the src attribute.
hielo 65 Veteran Poster
The real problem here is that you are calling the ajax request asynchronously. That's what the third parameter to req.open means.
true == asynchronous
false = synchronous
What that means is that when the script executes this:
req.send(null);
The javascript interpreter does not wait for the response. It continues executing your script.
Stop and think for a second. If the server takes 2 seconds to reply, but your javascript intepreter goes immediately to the next statement, then nB will not reflect the response from the server. That's why you need it to be synchronously. Basically, you are forcing the interpreter to pause until it gets a response.
The readystatechange and the readyState==4 are perfectly fine. To know if the error file does not exist you need to check for
req.status==404
200 means the files exists, but if it NOT 200, it does not necessarily mean it does not exist. For example
403 means you don't have permission to download the image/file, but it exists.
Also, ideally, your function imagexists() should return a value as shown below:
function imagexists(){
if(req.readyState == 4) {
if(req.status == 200)
{
// image exists
nB=false;
}
else if(req.status==404)
{// image doesn't exist
nB=true;
}
else
{
// all other error codes will set this
nB=null;
}
retur nB;
}
}
One last thing, if IE keeps giving you trouble, try
req.send('');
instead of req.send(null);
hielo 65 Veteran Poster
For the sake of debugging, change this:
req.open("head", imagepath, true);
to this:
req.open("HEAD", imagepath, false);
hielo 65 Veteran Poster
>>Don't how to print the error message in the content area
You need to trigger the error only while printing the content. For example the code below will NOT print it within the content because you are not triggering the error within the content:
<?php
$x = (int)$_POST['INPUT'];
if( $x==3)
trigger_error("Incorrect input vector, array of values expected", E_USER_WARNING);
?>
<html>
<body>
<?php
getContent();
?>
</body>
</html>
You can work around it by simply setting a variable to TRUE if trigger_error should be called, but delay the call until the content.
<?php
global $triggerIt=FALSE;
$x = (int)$_POST['INPUT'];
if( $x==3)
?>
<html>
<body>
<?php
if( TRUE==$triggerIt)
{
trigger_error("Incorrect input vector, array of values expected", E_USER_WARNING);
}
else
{
?>
getContent();
<?php
}
?>
</body>
</html>
You would also need to put:
global $triggerIt=FALSE;
in the same file where you are defining your errorHandler function. IF you are using some sort of templating system, then the
if( TRUE==$triggerIt){...}else{...}
part would be placed in the template. On my example, the getContent() should be a function defined on a per-page basis that returns the content for the page in question as a string. However, if you are using some third-party templating system, you would need to find out how they are emitting the content.
Short answer to your question, I believe you are triggering the error_handler outside of the content. In case you haven't seen it, there is a sample error handler at:
http://us2.php.net/manual/en/function.set-error-handler.php
hielo 65 Veteran Poster
I modified the code above slightly and works bor both, IE and FF. If the problem persists, it could be a browser version issue (as opposed to the browser family). Notice that instead of using document.getElementById, I am passing a reference to the object directly. This way you can reuse your function for just about any iframe, regardless of what id you assign to it.
Lastly, the default height and id will be used in case of an error. Typical scenario would be if the page that loads on the iframe is not from your domain. The try-catch is for the page to load up "silently".
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>iframe Height</title>
<style type="text/css"><!--
#testFrame{border:0;}
--></style>
</head>
<body>
<script type="text/javascript"><!--
function calcHeight(elem)
{
//find the height of the internal page
var the_height=500;
var padding=30;//to avoid the scroll bar
try
{
if( elem.contentWindow && elem.contentWindow.document)
{
the_height=elem.contentWindow.document.body.scrollHeight;
}
}
catch(e){}
//change the height of the iframe
elem.height=the_height +padding;
}
//--></script>
<iframe id="testFrame" onload="calcHeight(this)" src="test1.html"></iframe>
</body>
</html>
hielo 65 Veteran Poster
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script type="text/javascript"><!--
function insertAfter(parent, newNode, referenceNode)
{
parent.insertBefore(newNode, referenceNode.nextSibling);
}
window.dynamicNodeCount=0;
function addElement()
{
window.dynamicNodeCount++;
var dad = document.getElementById('container');
var elementAboveNew = document.getElementById('sib1');
var newElement = document.createElement('div');
newElement.innerHTML="Element " +window.dynamicNodeCount;
insertAfter(dad, newElement, elementAboveNew);
}
//--></script>
<div onclick="addElement();">Add Element</div>
<div id="container">
<div id="sib1">a</div>
</div>
</body>
</html>
scru commented: Hey thanks dude. +3
hielo 65 Veteran Poster
The problem you are encountering are because on every function you have:
var id_ul=document.getElementById("sub_menu_bg");
but on your HTML code you do not have any element with that id. To clarify, something similar to this should exist somewhere:
<ul id="sub_menu_bg">...</ul>
It does not have to be a <ul> element. See if the code below works for you.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script type="text/javascript"><!--
var image2=new Image()
image2.src="root/blue_ch.gif"
function show_select()
{
var id_ul=document.getElementById("sub_main_menma");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_men");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencal");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_menpr");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mensho");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencam1");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencam2");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_men");
id_ul.style.visibility="visible";
id_ul.style.display="";
id_ul.style.backgroundColor='#0f498d';
// var id_ul=document.getElementById("sub_menu_bg");
//id_ul.style.backgroundColor='#0f498d';
}
function hide_submenu()
{
var id_ul=document.getElementById("sub_men");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_men");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_menma");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_menpr");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencal");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mensho");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencam1");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencam2");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
// var id_ul=document.getElementById("sub_menu_bg");
// id_ul.style.backgroundColor='#0f498d';
//var id_ul=document.getElementById("mainurl");
//id_ul.style.backgroundImage="url(blue_link.gif)";
//='url(./blue_ch.gif)';
//var id_ul=document.getElementById("mainurl");
//id_ul.style.backgroundImage="url(blue_link.gif)";
}
function show_sub_menu1()
{
var id_ul=document.getElementById("sub_main_menma");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_men");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_menpr");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencal");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mensho");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencam1");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencam2");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_men");
id_ul.style.visibility="visible";
id_ul.style.display="";
var id_ul=document.getElementById("mainurl");
id_ul.style.backgroundImage="url(blue_ch.gif)";
// var id_ul=document.getElementById("sub_menu_bg");
// id_ul.style.backgroundColor='#0199DC';
}
function show_sub_menuma()
{
var id_ul=document.getElementById("sub_main_men");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_men");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_menpr");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencal");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mensho");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencam1");
id_ul.style.visibility="hidden";
id_ul.style.display="none";
var id_ul=document.getElementById("sub_main_mencam2"); …
hielo 65 Veteran Poster
Perhaps this will make things more clear:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css"><!--
.show{visibility:visible;display:'';background-color:#ffff00;background-image:url('/Images/background.gif');}
.hide{visibility:hidden;display:none}
--></style>
<script type="text/javascript"><!--
function activate(elemId)
{
var elem = document.getElementById(elemId);
if(elem)
{
elem.className = String(elem.className).replace(/\bhide\b/g,"");
elem.className = String(elem.className).replace(/ +/g," ");
elem.className += " show";
}
else
{
alert( "Error at activate("+elemId + "): element does not exist.");
}
}
function deactivate(elemId)
{
var elem = document.getElementById(elemId);
if(elem)
{
elem.className = String(elem.className).replace(/\bshow\b/g,"");
elem.className = String(elem.className).replace(/ +/g," ");
elem.className += " hide";
}
else
{
alert( "Error at deactivate("+elemId + "): element does not exist.");
}
}
//--></script>
</head>
<body>
<ul id="menu">
<li>a</li>
<li onmouseover="activate('submenu')" onmouseout="deactivate('submenu')">b
<ul id="submenu" class="hide">
<li>b1</li>
<li>b2</li>
</ul>
</li>
<li>c</li>
</ul>
</body>
</html>
hielo 65 Veteran Poster
The simplest way to solve your problem is to create "generic" CSS classes and define the desired properties to the classes instead. That way you do not need to do modify the element via:
elementRef.style.property='value';
Instead you would just say
elementRef.className='className';
hielo 65 Veteran Poster
Below is a complete example of how I would put the a() function that I gave you to use.
You can call show with the number of years as well as the id of the element where you want the results to appear. Example:
<input type="button" onclick="show(5,'myResults');" />
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hielo's Calculations</title>
<script type="text/javascript"><!--
function a(p,r,n)
{
return (parseFloat(p) * Math.pow( (1+parseFloat(r)), parseInt(n,10) )).toFixed(2);
}
function show(years,target)
{
var i=1;//starting year
var limit=10;//the default number of years if none specified
var destination=null;//where to write the results
var buffer=[];//to save the partial results
//check if user specified number of years and if so, override default
if(parseInt(years,10))
limit=parseInt(years,10);
//check if user specified target element to write results and if so, override default
if("string"==typeof(target))
{
destination=document.getElementById(target);
}
else//otherwise create a div dinaymically and append it to <body>. The results will be withing <div id='results'></div>
{
if( destination=document.createElement("div") )
{
destination.id="target";
document.getElementsByTagName('body')[0].appendChild(destination);
}
}
while(i<=limit)
{
buffer[buffer.length] = ( i + ". " + a("1000.00",".05",i) );
++i;
}
if(destination)
destination.innerHTML = "<div>"+buffer.join("</div><div>")+"</div>";
else//this execute only in very old browsers.
alert(buffer.join("\n"));
}
//--></script>
</head>
<body>
<form>
<input type="button" value="Compute" onclick="show(10,'myResults');"/>
</form>
<div id="myResults"></div>
</body>
</html>
hielo 65 Veteran Poster
Below is a complete example of how I would put the a() function that I gave you to use.
You can call show with the number of years as well as the id of the element where you want the results to appear. Example:
<input type="button" onclick="show(5,'myResults');" />
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hielo's Calculations</title>
<script type="text/javascript"><!--
function a(p,r,n)
{
return (parseFloat(p) * Math.pow( (1+parseFloat(r)), parseInt(n,10) )).toFixed(2);
}
function show(years,target)
{
var i=1;//starting year
var limit=10;//the default number of years if none specified
var destination=null;//where to write the results
var buffer=[];//to save the partial results
//check if user specified number of years and if so, override default
if(parseInt(years,10))
limit=parseInt(years,10);
//check if user specified target element to write results and if so, override default
if("string"==typeof(target))
{
destination=document.getElementById(target);
}
else//otherwise create a div dinaymically and append it to <body>. The results will be withing <div id='results'></div>
{
if( destination=document.createElement("div") )
{
destination.id="target";
document.getElementsByTagName('body')[0].appendChild(destination);
}
}
while(i<=limit)
{
buffer[buffer.length] = ( i + ". " + a("1000.00",".05",i) );
++i;
}
if(destination)
destination.innerHTML = "<div>"+buffer.join("</div><div>")+"</div>";
else//this execute only in very old browsers.
alert(buffer.join("\n"));
}
//--></script>
</head>
<body>
<form>
<input type="button" value="Compute" onclick="show(10,'myResults');"/>
</form>
<div id="myResults"></div>
</body>
</html>
hielo 65 Veteran Poster
"Error loading stylesheet..." is typically reported by the XSL parser, not the browser. What I am suggesting is to open up Firefox and type(as an example):
http://www.yoursite.com/Project/myFile.xsl
Firefox will not try to parse/interpret your XSL file. But it will try to create a "tree-node" representative of the document. Things that the browser will spot easily for you are for example:
& instead of &
or unclosed elements (<br> instead of <br />) or mismatching elements (<span><div></div></span>)
etc.
IF the problem on the file are permissions, the browser will also report it because it will not be able to retrieve it from the server.
hielo 65 Veteran Poster
Javascript has built-in functions, meaning it already comes with some functions that you can just use. It also lets you create your own functions.
show() is not a built in function.
For the following to work:
<input type="button" value="click to see the result" onClick="show()">
you would need to create a function called show. Within the show function you need to call the while loop I posted previously. The only thing however is that before the while loop you would need to write:
document.open();
and after the while's closing brace you would need:
document.close();
Try it, and let me know what happens.
hielo 65 Veteran Poster
Try these instead:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hielo's Parent Page</title>
</head>
<body>
<script type="text/javascript">
var child_window=null;
var parent_window=window;
function popUponClick()
{
child_window = window.open("p.html", "mySelect", "status=1,width=750,height=450,resizable=no");
parent_window.onclick = blurify;
parent_window.onfocus = blurify;
return false;
}
function blurify()
{
if(child_window)
{
if(parent_window)
parent_window.blur();
child_window.focus();
}
}
</script>
<form name="formSelect">
<p><a href="#" onclick='return popUponClick();'>show popup window</a><br /></p>
</div>
</form>
</body>
</html>
========================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hielo's Child Page</title>
<script type="text/javascript"><!--
var parent_window = window.opener;
var child_window = window.self;
function closeIt()
{
if(parent_window)
{
if(window.ActiveXObject)
{
child_window.blur();
parent_window.focus();
}
parent_window.close();
child_window.focus();
parent_window=null;
}
}
//--></script>
</head>
<body>
<form action="." method="POST">
<input type="button" value="Close Parent" onclick="closeIt();"/><input type="button" value="Close Me" onclick="self.close();"/>
</form>
</body>
</html>
hielo 65 Veteran Poster
Try this:
<script language="VBScript" runat=Server>
Dim xmlDOC
Dim bOK
Dim HTTP
Set HTTP = CreateObject("MSXML2.XMLHTTP")
Set xmlDOC =CreateObject("MSXML.DOMDocument")
xmlDOC.Async=False
HTTP.Open "GET","http://topics.cnn.com/topics/feeds/rss/technology", False
HTTP.Send()
bOK = xmlDOC.load(HTTP.responseXML)
if Not bOK then
Response.Write "Error loading XML from HTTP"
end if
Dim objNodeList
Set objNodeList=xmlDOC.documentElement.selectNodes("//rss/channel/item/title")
Response.Write "Total Items: "& objNodeList.Length
Dim I
For I = 0 to objNodeList.Length -1
Response.Write "<div>" & objNodeList(i).text & "</div>"
next
Response.Write "Status: " & HTTP.statusText
</script>
hielo 65 Veteran Poster
There could be various reasons. To name a few:
1. Invalid/Wrong path to the stylesheet
2. Invalid characters in the stylesheet
3. Improper syntax
4. Insufficient Permissions on the file
Open the XSL file directly through FF. If the problem is any of 1-3, then it will tell you on which line the error occured.
hielo 65 Veteran Poster
First of all, your code does not show where you initialized xmlDoc. I see xslDoc, but not xmlDoc. I assume this happens before the posted code.
With the assumptions above, the method "transformNode" is only valid for
xml objects created specifically for IE. In your code, this would be:
xslDoc=new ActiveXObject("Microsoft.XMLDOM");
However, the reason you get the error is because xmlDoc is not an ActiveXObject('Microsoft.XMLDOM'). FF does not support such object. It has its own object with its own methods.
The following page might be instructive if you want to pursue this route. Meaning, if you want to write your own "library". Section 8.13 uses the transformNode and shows you how to do the same for FF.
http://www.dcs.bbk.ac.uk/~ptw/teaching/client-2/notes.html
However, my recommendation is for you to download the Sarissa library. Basically, it is a library that takes care of these browser incompatibilities. Thus, you don't need to remember/learn the IE syntax and Firefox Syntax or whatever other browser syntax. You just need to learn the sarissa functions and how to use them to perform your transformations. Most often than not, once your script works on one browser, it automatically works on the others! I cannot stress enough how much of a head ache you will avoid by pursing this route instead. Good Luck.
hielo 65 Veteran Poster
Rather than checking each of the required input elements within the switch, you can simply provide a css class to each of the required elements. EX:
<input type="text" name="first" class="required" value=""/>
Then, your script will check each of the form elements for the existence if this "required" class and if so, then you check if it was actually filled.
Here is your modified code in it's entirety. Pay attention how I specified the required fields in the form elements rather than on the script.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script language="javascript">
function validateform() {
valid=true;
var f = document.getElementById('userdetails');
for (var i=0; i < f.elements.length; i++)
{
var element = f.elements[i];
if( /\brequired\b/i.test( element.className ) && !String(element.value).length )
valid=false;
}
if (valid)
{
respons = confirm("Do you want to proceed?");
if (respons)
return true;
else
return false;
}
else
{
alert ("Please fill in all required fields marked with *");
return false;
}
return false;
}
</script>
<script language="javascript" src="utils.js"></script>
</head>
<body>
<form id="userdetails" method="post" action="care1.php" onSubmit="return validateform();">
<table>
<tr>
<td>Company Name </td>
<td><input type="text" class="required" name="cname" size="53"></td>
<td><span style="color:red;">*</span></td>
</tr>
<tr><td>Address </td>
<td><TEXTAREA NAME="caddr" COLS="40" ROWS="3" class="required" ></TEXTAREA></td>
<td><span style="color:red;">*</span></td>
</tr>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
You are welcome!
hielo 65 Veteran Poster
Assuming you would like to change the backgroud of:
<p id="para1">Text</p>
You would do so as follows:
document.getElementById('para1').style.backgroundImage='http://www.site.com/Images/yourImage.gif';
hielo 65 Veteran Poster
<script type="text/javascript"><!--
function a(p,r,n)
{
return (parseFloat(p) * Math.pow( (1+parseFloat(r)), parseInt(n,10) )).toFixed(2);
}
//call it as follows:
var i=1;
while(i<=10)
{
document.write( i + ". "+ a("1000.00",".05",i) +"<br />");
++i;
}
//--></script>