Hallo,
Versuch doch mal, das Problem auf ein ganz einfaches Beispiel zu reduzieren.
Schreib mal eine ganz simple Html-Seite, mit zwei Script-Aufrufen, nämlich a) das prototype-Framework und b) eine ganz simple selbstgeschriebene Funktion.
D.H., reduziere das Problem auf möglichst wenig Code.
Wenn der „Fehler“ da auch auftritt und Du ihn nicht wahrscheinlich bereits gelöst hast, poste das doch nochmal bitte.
Dein aktueller Code (ohne prototype.js) ist soo lang, Du erwartest doch nicht ernsthaft, das ich mich da reinlese.
Das dauerte 5 Stunden…siehe unten.
Gruß, Nils
Htmlseite:
Wirklich schwere Sudoku 5. Juli 2006 - Moritz Lenz
Moritz Lenz
Home|
Universität|
Projekte|
[
Sudoku](/sudoku.shtml)|
Gallerien|
Über mich|
Diverses
Sudoku-Seiten im Überblick:
Schritt
für Schritt gelöst
<!–
document.writeln("\<div class=„sideBox RHS“\>");
document.writeln("<span>Anzeigen</span>");
google_ad_client = „pub-3564070552657348“;
google_alternate_ad_url = „http://moritz.faui2k3.org/sudoku_online.shtml“;
google_ad_width = 180;
google_ad_height = 150;
google_ad_format = „180x150_as“;
google_ad_type = „text“;
google_ad_channel ="";
google_color_border = „FFFFFF“;
google_color_bg = „E4EEFF“;
google_color_link = „70709F“;
google_color_text = „000000“;
google_color_url = „000000“;
//–>
document.writeln("\</div\>");
Täglich schwere Sudoku - 5. Juli 2006
Meldungen:
Zeit: 0:00
Zuschlag: 0:00
<!–
solved = [
[5, 1, 6, 8, 9, 2, 7, 3, 4],
[4, 2, 8, 3, 7, 5, 6, 9, 1],
[9, 3, 7, 1, 4, 6, 8, 2, 5],
[8, 5, 9, 6, 3, 4, 1, 7, 2],
[7, 4, 2, 9, 5, 1, 3, 6, 8],
[1, 6, 3, 7, 2, 8, 5, 4, 9],
[3, 9, 5, 4, 8, 7, 2, 1, 6],
[6, 8, 4, 2, 1, 3, 9, 5, 7],
[2, 7, 1, 5, 6, 9, 4, 8, 3],
];
initial_sudoku = table_to_array();
last_field = table_to_array();
sudoku_init();
short_date = „2006-07-05“;
//–>
Sie haben Javascript deaktiviert. Dadurch stehen ihnen die fortgeschritteneren Funktionen wie das automatische Lösen von Sudoku nicht zur Verfügung. Sollten Sie diese Funktionen wollen, aktivieren Sie bitte Javascript.
top
Glückwunsch, mit Ihrem Ergebnis kommen Sie in die
Bestenliste
Wenn Sie möchten, können Sie hier ihren Namen
und eventuell einen Kommentar hinterlassen, der auf dieser
Seite angezeigt wird.
Der Betreiber dieser Website behält sich jedoch das
Recht vor, Einträge nach eigenem Ermessen zu
löschen.
Hinweis: leider gibt es bei den Hiscores zur Zeit
Probleme mit Umlauten. Verwenden Sie bitte „Ae“ anstatt
„Ä“, „ss“ anstelle von „ß“ usw.
Name
Kommentar
Abschicken
Hiscores
Nr.NameZeit (1)Zeit (2)
TippsPrüfen 1Prüfen 2
DatumKommentar
1Moritz19:5513:155032006-07-05 01:31Werden die Rätsel leichter oder ich besser? *bg*2Moritz19:5913:195502006-07-05 01:34Werden die Rätsel leichter oder ich besser? *bg*
top
Erklärungen
Prüfen 1
Prüft das Sudoku auf Kollisionen, d.h.
Regelverstöße. Ein Sudoku, das keine
Regelverstöße enthält, kann trotzdem falsch sein, da
eventuell einige Felder nicht mehr ausfüllbar sein können.
Zuschlag: 30 Sekunden.
Prüfen 2
Überprüft alle bisher eingetragenen Zahlen und meldet,
wenn sie von der richtigen Lösung abweicht.
Zuschlag: 50 Sekunden.
Tipp
Füllt ein zufälliges freies Feld mit der richtigen Zahl
aus.
Zuschlag: 50 Sekunden.
Lösen
Löst das aktuelle Sudoku, d.h. füllt alle Felder mit
der richtigen Lösung.
Zuschlag: 50 Sekunden pro fehlender/falscher Zahl.
Erklärungen der Hiscores
Nr.
Platzierung
Zeit (1)
Die Zeit, die man für das Lösen des Sudoku gebraucht hat,
plus Zuschläge (z.B. für Tipps). Nach dieser Zeit wird die
Liste platziert.
Zeit (2)
Die Zeit, die man für das Lösen des Sudoku gebraucht
hat.
top
Impressum
Valid XHTML 1.0 Strict
Valid CSS
Wieso Werbung?
Design von:
oswd.org
Letzte Änderung:
05.07.2006, 00:04
Javascripte (ohne prototype.js):
http://moritz.faui2k3.org/sudoku_online/sudoku-assi.js
_/* Sudoku assistent */
/* requires prior inclusion of prototype.js */
var hints_count = 0;
var check1_count = 0;
var check2_count = 0;
var last_field = [];
var s_history = [];
var s_history_pointer = -1;
var hilight_errors = true;
var short_date = „“;
var won = false;
/* keep Track of active element (e.g. the one with the focus.
Taken from https://jalbum.net/forum/thread.jspa?messageID=24532 */
var activeElement = null;
function blurHandler(evt) {
activeElement = null;
}
function focusHandler(evt) {
var e = evt ? evt : window.event;
if (!e) return;
if (e.target)
activeElement = e.target;
else if(e.srcElement) activeElement = e.srcElement;
}
function loadHandler() {
var i, j;
for (i = 0; i 1){
return false;
}
}
return true;
}
function check_col(col) {
test = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for (i = 0; i 1){
return false;
}
}
return true;
}
function check_block(a_x, a_y){
test = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for (x = 0; x 1){
return false;
}
}
return true;
}
function get_val(x, y){
f = $F(‚s‘ + x + ‚‘ + y);
if (’’ == f){
res = 0;
} else {
res = parseInt(f);
}
if (res){
return(res);
} else {
return 0;
}
}
function validate() {
var res = true;
for (x = 0; x 0 && solved[x][y] != r){
if (hilight_errors){
get_item(x, y).style.backgroundColor = „#FF9999“;
get_item(x, y).parentNode.style.backgroundColor = „#FF9999“;
} else {
return false;
}
res = false;
}
}
}
return res;
}
function solve() {
for (x = 0; x 1){
hints_count = parseInt(hints[0]);
check1_count = parseInt(hints[0]);
check1_count = parseInt(hints[0]);
}
loadHandler();
}
function save_persistent_variables() {
var hints = [hints_count, check1_count, check2_count];
$(„hints“).value = hints.join(";");
$(„time“).value = time;
}
function timer_update() {
time ++;
$(„timer“).innerHTML = time_pretty_print(time);
$(„time_penalty“).innerHTML = time_pretty_print(time_penalty());
save_persistent_variables();
if (timer_enabled){
window.setTimeout(„timer_update()“, 1000);
}
}
function time_penalty() {
return 50 * (hints_count + check2_count) + 30 * check1_count;
}
function time_pretty_print(s) {
var min = parseInt(s/ 60);
var sec = s % 60;
if (sec > 9){
return min + ‚:‘ + sec;
} else {
return min + ‚:0‘ + sec;
}
}
function hiscore_send() {
if (! won) {
my_alert(„Sie muessen gewinnen und einen hiscore abschicken zu koennen“);
return;
}
var name = $F(„hi_name“);
var comment = $(„hi_comment“);
var score = time + time_penalty();
var url = „/sudoku_online/hiscore.pl?date=“ + short_date +
„&action=add“;
var post_data = Form.serialize($(„hi_enter“));
post_data = post_data + „&time=“ + time + „&hints=“ + hints_count +
„&score=“ + score + „&check1=“ + check1_count + „&check2=“ +
check2_count;
$(„sudoku_hiscore_enter“).style.visibility = „hidden“;
$(„sudoku_hiscore_enter“).style.height = „0px“;
var ajax = new Ajax.Updater (
‚hiscore_list‘,
url,
{
method: „post“,
postBody: post_data,
});
}
function jump(event) {
var e = event ? event : Try.these(
function (){return event;},
function (){return window.event;},
function (){return document.event;});
if (activeElement && e && e.keyCode){
var k = e.keyCode;
if (k 40){
return;
}
var a = activeElement.id;
var y = parseInt(a.slice(1,2));
var x = parseInt(a.slice(2,3));
if (k == 37 && x > 0){
/* move left */
x–;
} else if (k == 39 && x 0){
/* move up */
y–;
} else if (k == 40 && y
Inline Script from http://moritz.faui2k3.org/sudoku_online/2006-07-05.s…
http://pagead2.googlesyndication.com/pagead/show_ads.js
(function(){
function m(b){return b!=null?’"’+b+’"’:’""’}
function B(b){if(typeof encodeURIComponent==„function“){return encodeURIComponent(b)}else{return escape(b)}}
function c(b,a){if(a){window.google_ad_url+="&"+b+"="+a}}
function f(b,a){if(a){c(b,B(a))}}
function l(b,a,d){if(a&&typeof a==„object“){a=a[d%a.length]}c(„color_“+b,a)}
function D(b,a){var d=b.screen;var g=navigator.javaEnabled();var e=-a.getTimezoneOffset();if(d){c(„u_h“,d.height);c(„u_w“,d.width);c(„u_ah“,d.availHeight);c(„u_aw“,d.availWidth);c(„u_cd“,d.colorDepth)}c(„u_tz“,e);c(„u_his“,history.length);c(„u_java“,g);if(navigator.plugins){c(„u_nplug“,navigator.plugins.length)}if(navigator.mimeTypes){c(„u_nmime“,navigator.mimeTypes.length)}}
function y(b){b=b.toLowerCase();if(b.substring(0,3)!=„ca-“){b=„ca-“+b}return b}
function G(b,a,d){d=d.substring(0,1000);d=d.replace(/%\w?$/,"");if(b.google_ad_output==„js“&&(b.google_ad_request_done||b.google_radlink_request_done)){a.write(’’
);a.write("</iframe>")}}else if(b.google_ad_output==„textlink“){a.write(’<script language=„JavaScript1.1“ src=’+m(d)+"></script>")}}
function F(b){var a=null;b.google_ad_frameborder=a;b.google_ad_format=a;b.google_page_url=a;b.google_language=a;b.google_gl=a;b.google_country=a;b.google_region=a;b.google_city=a;b.google_hints=a;b.google_safe=a;b.google_encoding=a;b.google_ad_output=a;b.google_max_num_ads=a;b.google_ad_channel=a;b.google_contents=a;b.google_alternate_ad_url=a;b.google_alternate_color=a;b.google_color_bg=a;b.google_color_text=a;b.google_color_link=a;b.google_color_url=a;b.google_color_border=a;b.google_color_line=
a;b.google_adtest=a;b.google_kw_type=a;b.google_kw=a;b.google_num_radlinks=a;b.google_max_radlink_len=a;b.google_rl_filtering=a;b.google_rl_mode=a;b.google_rt=a;b.google_ad_type=a;b.google_image_size=a;b.google_feedback=a;b.google_skip=a;b.google_page_location=a;b.google_referrer_url=a;b.google_ad_region=a;b.google_ad_section=a;b.google_bid=a;b.google_cpa_choice=a;b.google_cust_age=a;b.google_cust_gender=a;b.google_cust_interests=a;b.google_cust_id=a;b.google_cust_job=a}
function A(){var b=null;var a=window;var d=document;var g=new Date;var e=g.getTime();var j=a.google_ad_format;if(a.google_cpa_choice){a.google_ad_url="[http://pagead2.googlesyndication.com/cpa/ads?";a.goo…](http://pagead2.googlesyndication.com/cpa/ads?";a.google_ad_url+=„client=“+escape(y(a.google_ad_client));a.google_ad_region=%22_google_cpa_region_%22;c(%22cpa_choice%22,a.google_cpa_choice);if(typeof) d.characterSet!=„undefined“){f(„oe“,d.characterSet)}else if(typeof d.charset!=„undefined“){f(„oe“,d.charset)}}else{a.google_ad_url=„http://pagead2.googlesyndication.com/pagead/ads?“
;a.google_ad_url+=„client=“+escape(y(a.google_ad_client))}var k=a.google_num_slots_by_client;var w=a.google_num_slots_by_channel;var i=a.google_prev_ad_formats_by_region;a.onerror=a.google_org_error_handler;if(a.google_ad_region==b&&a.google_ad_section!=b){a.google_ad_region=a.google_ad_section}var h=a.google_ad_region==b?"":a.google_ad_region;var q=false;if(j){q=j.indexOf("_0ads")>0}if(q){if(a.google_num_0ad_slots){a.google_num_0ad_slots=a.google_num_0ad_slots+1}else{a.google_num_0ad_slots=1}if(
a.google_num_0ad_slots>1){return}}else if(!a.google_cpa_choice){if(a.google_num_ad_slots){a.google_num_ad_slots=a.google_num_ad_slots+1}else{a.google_num_ad_slots=1}if(a.google_num_slots_to_rotate){i[h]=b;if(a.google_num_slot_to_show==b){a.google_num_slot_to_show=e%a.google_num_slots_to_rotate+1}if(a.google_num_slot_to_show!=a.google_num_ad_slots){return}}else if(a.google_num_ad_slots>3&&h==""){return}}c(„dt“,g.getTime());c(„hl“,a.google_language);if(a.google_country){c(„gl“,a.google_country)}else{
c(„gl“,a.google_gl)}c(„gr“,a.google_region);f(„gcs“,a.google_city);f(„hints“,a.google_hints);c(„adsafe“,a.google_safe);c(„oe“,a.google_encoding);c(„lmt“,a.google_last_modified_time);f(„alternate_ad_url“,a.google_alternate_ad_url);c(„alt_color“,a.google_alternate_color);c(„skip“,a.google_skip);var n=a.google_ad_client;if(!k[n]){k[n]=1;k.length+=1}else{k[n]+=1}if(i[h]){f(„prev_fmts“,i[h].toLowerCase());if(k.length>1){c(„slot“,k[n])}}if(j){f(„format“,j.toLowerCase());if(i[h]){i[h]=i[h]+","+j}else{i[
h]=j}}c(„num_ads“,a.google_max_num_ads);c(„output“,a.google_ad_output);c(„adtest“,a.google_adtest);if(a.google_ad_channel){var r=a.google_ad_channel.toLowerCase();f(„channel“,r);var s="";var t=r.split("+");for(var o=0;o<t.length;o++){var p=t[o];if(!w[p]){w[p]=1}else{s+=p+"+"}}f(„pv_ch“,s)}f(„url“,a.google_page_url);l(„bg“,a.google_color_bg,e);l(„text“,a.google_color_text,e);l(„link“,a.google_color_link,e);l(„url“,a.google_color_url,e);l(„border“,a.google_color_border,e);l(„line“,a.google_color_line,
e);c(„kw_type“,a.google_kw_type);f(„kw“,a.google_kw);f(„contents“,a.google_contents);c(„num_radlinks“,a.google_num_radlinks);c(„max_radlink_len“,a.google_max_radlink_len);c(„rl_filtering“,a.google_rl_filtering);c(„rl_mode“,a.google_rl_mode);c(„rt“,a.google_rt);c(„ad_type“,a.google_ad_type);c(„image_size“,a.google_image_size);c(„region“,a.google_ad_region);c(„feedback_link“,a.google_feedback);f(„ref“,a.google_referrer_url);f(„loc“,a.google_page_location);c(„bid“,a.google_bid);c(„cust_age“,a.google_cust_age)
;c(„cust_gender“,a.google_cust_gender);c(„cust_interests“,a.google_cust_interests);c(„cust_id“,a.google_cust_id);c(„cust_job“,a.google_cust_job);if(z(a,d)&&d.body){var u=d.body.scrollHeight;var v=d.body.clientHeight;if(v&&u){f(„cc“,Math.round(v*100/u))}}D(a,g);G(a,d,a.google_ad_url);F(a)}
function C(b,a,d){A();return true}
function z(b,a){return b.top.location==a.location}
function x(b,a){var d=a.documentElement;if(z(b,a))return false;if(b.google_ad_width&&b.google_ad_height){var g=1;var e=1;if(b.innerHeight){g=b.innerWidth;e=b.innerHeight}else if(d&&d.clientHeight){g=d.clientWidth;e=d.clientHeight}else if(a.body){g=a.body.clientWidth;e=a.body.clientHeight}if(e>2*b.google_ad_height||g>2*b.google_ad_width){return false}}return true}
function E(){var b=window;var a=document;var d=a.location;var g=a.referrer;var e=null;b.google_org_error_handler=b.onerror;b.onerror=C;if(b.google_ad_frameborder==e){b.google_ad_frameborder=0}if(b.google_ad_output==e){b.google_ad_output=„html“}if(b.google_ad_format==e&&b.google_ad_output==„html“){b.google_ad_format=b.google_ad_width+„x“+b.google_ad_height}if(b.google_page_url==e){b.google_page_url=g;if(!x(b,a)){b.google_page_url=d;b.google_last_modified_time=Date.parse(a.lastModified)/1000;b.google_referrer_url=
g}}else{b.google_page_location=g;if(!x(b,a)){b.google_page_location=d}}if(b.google_num_slots_by_channel==e){b.google_num_slots_by_channel=new Array}if(b.google_num_slots_by_client==e){b.google_num_slots_by_client=new Array}if(b.google_prev_ad_formats_by_region==e){b.google_prev_ad_formats_by_region=new Array}}
E();A();
})()
</I>
Inline Script from http://moritz.faui2k3.org/sudoku_online/2006-07-05.s…
<I>
document.writeln("\</div\>");
</I>
Inline Script from http://moritz.faui2k3.org/sudoku_online/2006-07-05.s…
<I>
<!–
solved = [
[5, 1, 6, 8, 9, 2, 7, 3, 4],
[4, 2, 8, 3, 7, 5, 6, 9, 1],
[9, 3, 7, 1, 4, 6, 8, 2, 5],
[8, 5, 9, 6, 3, 4, 1, 7, 2],
[7, 4, 2, 9, 5, 1, 3, 6, 8],
[1, 6, 3, 7, 2, 8, 5, 4, 9],
[3, 9, 5, 4, 8, 7, 2, 1, 6],
[6, 8, 4, 2, 1, 3, 9, 5, 7],
[2, 7, 1, 5, 6, 9, 4, 8, 3],
];
initial_sudoku = table_to_array();
last_field = table_to_array();
sudoku_init();
short_date = „2006-07-05“;
//–>
</I>
http://pagead2.googlesyndication.com/pagead/ads?clie…
Inline Script from http://pagead2.googlesyndication.com/pagead/ads?clie…
<I>
<!–
function ss(w,id) {window.status = w;return true;}function cs(){window.status=’’;} function jcc(a) {pha=document.getElementById(a); nc=pha.href.indexOf(’&jca=’); if(nc>=1) return; sv=String.fromCharCode(57,52,52,52,52,57,49,49,57); sv=sv.slice(3,7); jca=(3545)+parseInt(sv); if (a==‚aw0‘) {jca+=(-2910);} else {jca=0;} phb=pha.href+’&jca=’+jca; pha.href=phb;} function ha(a){ pha=document.getElementById(a); nhi=pha.href.indexOf("&nh=");if(nhi < 1) {phb=pha.href+"&nh=1";} pha.href=phb; jcc(a); }function ca(a) { pha=document.getElementById(a); nci=pha.href.indexOf("&nc=");if(nci < 1) {phb=pha.href+"&nc=1";} pha.href=phb; jcc(a); top.location.href=document.getElementById(a).href;}function ga(o,e) {if (document.getElementById) {a=o.id.substring(1);p = „“;r = „“;g = e.target;if (g) {t = g.id;f = g.parentNode;if (f) {p = f.id;h = f.parentNode;if (h)r = h.id;}} else {h = e.srcElement;f = h.parentNode;if (f)p = f.id;t = h.id;}if (t==a || p==a || r==a)return true;pha=document.getElementById(a); nbi=pha.href.indexOf("&nb=");if(nbi < 1) {phb=pha.href+"&nb=1";} pha.href=phb; jcc(a); top.location.href=document.getElementById(a).href;}}
//–>
</I>
Inline Script from http://pagead2.googlesyndication.com/pagead/ads?clie…
<I>
<!–
nw=’#000000’;nw=nw.slice(1);if(’’)document.write(’<img border=0 align=right height=13 width=13 src=„http://pagead2.googlesyndication.com/pagead/’+nw+’_n…“ alt=""/>’);//–>
</I>_