 |
| Javascript General Javascript discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 19th, 2004, 04:52 PM
|
|
Friend of Wrox
|
|
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Not Implemented Error
Anyone ever run into the Not Implemented Error before? I haven't a clue as to what it means. Any help would be appreciated.
Clay Hess
__________________
Clay Hess
|
|

May 20th, 2004, 05:20 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It depends what you're trying to do. You tend to get this error when you are trying to do something (usually involving a redirect - or at least, that's the classic case) that isn't actually supported by the HTTP protocol, for security reasons. There are all sorts of things involving redirects that could be used for Phishing-type attacks on users, if they were implemented within the hypertext protocol.
As was revealed in a recent thread on the PHP lists, redirection is one of the commonest ways in which all the major browsers (yes, Mozilla, too) fail to adhere properly to the standards. See:
ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html
(Sweet mother of Jesus - third edit! I'd like to see what genius came up with the script for munging URLs on this forum!
Don't just click on the link above, because the ASP scripts this site uses will leave the 'ppe' portion of the hostname off, in the above URL, and I can't work out how to stop it doing so. To summarise: the first portion of the URL above should read 'ppewww', not 'www', as the script seems to think, so just cut&paste the whole URL into a new browser address bar.)
|
|

May 20th, 2004, 08:32 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the note, but I am not doing a redirect. Here is the code that is causing the error...
<script language="JavaScript">
function setChecked(selvalue)
{
if(ID[0][2] == 'Y')
{
document.getElementById(selvalue).selectedIndex = 0;
}
else
{
document.getElementById(selvalue).selectedIndex = 1;
}
}
onload = setChecked('opt3308');
</script>
All I am trying to do is to set the yes no value of a select menu equal to an array variable. Thoughts on the error?
Quote:
quote:Originally posted by Daniel Walker
It depends what you're trying to do. You tend to get this error when you are trying to do something (usually involving a redirect - or at least, that's the classic case) that isn't actually supported by the HTTP protocol, for security reasons. There are all sorts of things involving redirects that could be used for Phishing-type attacks on users, if they were implemented within the hypertext protocol.
As was revealed in a recent thread on the PHP lists, redirection is one of the commonest ways in which all the major browsers (yes, Mozilla, too) fail to adhere properly to the standards. See:
ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html
(Sweet mother of Jesus - third edit! I'd like to see what genius came up with the script for munging URLs on this forum!
Don't just click on the link above, because the ASP scripts this site uses will leave the 'ppe' portion of the hostname off, in the above URL, and I can't work out how to stop it doing so. To summarise: the first portion of the URL above should read 'ppewww', not 'www', as the script seems to think, so just cut&paste the whole URL into a new browser address bar.)
|
Clay Hess
|
|

May 20th, 2004, 08:56 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Clay,
I wasn't getting the same error, but I got your code to work like this...
<script language="JavaScript">
// dummy array for testing
var ID = [[1,2,"N"]];
function setChecked(selvalue)
{
if(ID[0][2] == 'Y')
{
document.getElementById(selvalue).selectedIndex = 0;
}
else
{
document.getElementById(selvalue).selectedIndex = 1;
}
}
// you can't set onload this way - you are setting onload to the return value of setChecked()
//onload = setChecked('opt3308');
// but you can create a function to be called when the onload event fires...
onload = function(){setChecked('opt3308')};
</script>
with a select element as follows in the page...
<select id="opt3308">
<option value="1">one</option>
<option value="2">two</option>
</select>
Best regards,
Chris
|
|

May 20th, 2004, 09:02 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
The error is caused by the way you set the onload handler. I don't think you can set a method name and pass in a variable as well. You'll have to create a new function that calls your code, like this:
Code:
onload = new Function ("setChecked('opt3308');");
Alternatively, and much easier, set the onload attribute of the <body> tag:
Code:
<body onload="setChecked('opt3308');">
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Getaway Car by Audioslave (Track 13 from the album: Audioslave) What's This?
|
|

May 20th, 2004, 09:45 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok...it is as clear as mud to me...I tried it like Chris suggested, I do not get the error, but the script does not work. Plus I do not understand why having function() and putting the actual function inside of {} helps? If someone can expound, I would appreciate it.
Imar, I tried your way with putting it in the body...did not work because I already have an onload in the body tag. As for your other suggestion, you have a function calling a function? how does that help and just how do you do that? I have never done that and do not know the syntax, especially for carrying through values.
Help!
Clay Hess
|
|

May 20th, 2004, 09:52 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
You can put multiple functions inside the onLoad body attribute like this:
<body onload="function1(); function2(163); function3('value');">
HTH,
Snib
<><
|
|

May 20th, 2004, 09:52 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Clay,
I tested the page before I posted it, and it worked fine, so maybe something else is going wrong. Anyway, I don't have a function calling another function, but to the onload event, I assign a new function created on-the-fly. By assigning new Function(bla bla bla) to the onload event, the code bla bla bla is executed.
The onload attribute of the body tags allows multiple function calls. Just separate them with a semi colon:
<body onload="functonA();functionB();setChecked('opt3308 ');">
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Dirty boots by Sonic Youth (Track 5 from the album: Dirty boots) What's This?
|
|

May 20th, 2004, 09:59 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Clay,
If you already have an onload attribute in your body tag, you can add more function calls to this e.g.
<body onload="function1(); function2();">
onload = function(){setChecked('opt3308')}; and onload = new Function ("setChecked('opt3308');"); do the same thing - they create a new function to be executed (but do not call it) when the onload event fires, you need to do this because simply coding onload = setChecked('opt3308'); causes the code on the right of the "=" sign to be evaluated & assigned to the item on the left, in this case onload. If your function had no parameters, you could simply use onload = setChecked;
The reason the code I posted is not working is that by setting a value for the onload attribute in the body tag, you are overriding the onload function specified by onload = function(){setChecked('opt3308')};
Cheers 4 now,
Chris
|
|

May 20th, 2004, 10:04 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, the reason the onload in the body tag won't work is because the select menu is not rendered yet. So it is firing upon something that does not exist. SO that did not work. I tried the following code per Imar and it did not work...thoughts?...
function setChecked0(selvalue)
{
if(ID[0][2] == 'Y')
{
document.getElementById(selvalue).selectedIndex = 0;
}
else
{
document.getElementById(selvalue).selectedIndex = 1;
}
}
//onload = setChecked0('opt3308');
onload = new Function ("setChecked('opt3308');");
By the way, when I uncomment my original code, the code itself works but I get the not implemented error.
Clay Hess
|
|
 |