Visualizzazione dei risultati da 1 a 10 su 10

Discussione: dove erro

  1. #1
    Utente di HTML.it L'avatar di Mi|{y
    Registrato dal
    Apr 2003
    Messaggi
    117

    dove erro

    errore:

    Microsoft JScript runtime error '800a139c'

    Expected ')' in regular expression

    /ricercainterna2/ass-engine.asp, line 1055
    codice:
    	var lreg_newLine			= /[\f\n\r\t]+/g;
    	var lreg_spaces				= / {2,}/g;
    	var lreg_htmlSpaces			= /(?:)*/gi;
    	
    	
    	//This randomizes the number of characters grabbed for the
    	//summary so all of the high lighting doesn't appear in the
    	//same place.
    	var lobj_Date		= new Date();
    	var i				= lobj_Date.getMilliseconds() % 3;
    	li_spacingBegining	= lary_spacingBegining[i];
    	li_spacingEnd		= lary_spacingEnd[i];
    	delete lobj_Date;
    	
    	//remove any new line characters and anything with more then 2 spaces.
    	ls_strippedResults	= arg_s_fileContents.replace( lreg_newLine,'' ).replace( lreg_spaces, '' ) .replace(lreg_htmlSpaces, '' );
    	li_searchIndex = ls_strippedResults.search( arg_ary_match[0] );
    l'ultima riga é la linea 1054

    la faccina é la modifica del carattere &_nbsp;_) senza le underscore

    help me

  2. #2
    Utente di HTML.it L'avatar di Mi|{y
    Registrato dal
    Apr 2003
    Messaggi
    117
    si scusate é la 1055 non la 1054

  3. #3
    Utente di HTML.it L'avatar di Mi|{y
    Registrato dal
    Apr 2003
    Messaggi
    117
    vi posto una parte del codice precendente che credo possa far capir meglio


    codice:
    //function getPageSummary( arg_s_fileContents, arg_ary_match )
    //-Argument(s):	arg_s_fileContents - the entire file text
    //				arg_ary_match - the array containing the found search terms
    //-Returns:		The finished summary text
    //-Description:	Scans the entire page for the search term, then pulls a bit of text
    //				before and after the found term. How much text it pulls is semi-random.
    //				It uses the number of characters in the lary_spacingBegining & 
    //				lary_spacingEnd arrays. This function also wraps the found term(s) 
    //				in a <span> tag so you can highlight it via CSS.
    //,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    function getPageSummary( arg_s_fileContents, arg_ary_match ) {
    	var lary_spacingBegining	= new Array( 30, 50, 70 );
    	var lary_spacingEnd			= new Array( 100, 80, 60 );
    	
    	var li_spacingBegining		= 0;
    	var li_spacingEnd			= 0;
    	var ls_summary				= "";
    	var ls_strippedResults		= "";
    	var ls_highlightedTerm		= "";

  4. #4
    Utente di HTML.it
    Registrato dal
    Sep 2001
    Messaggi
    21,188
    Per definire una RegExp in JS c'e` il costruttore di RegExp:

    var lreg_newLine = new RegExp(/[\f\n\r\t]+/,"g");

    In alternativa prova a togliere il puntoevirgola alla fine. Ho l'impressione che venga inserito anche quello nella RE, e poi non si ritrova piu`.

    Ciao
    Michele
    Nuova politica di maggiore severita` sui titoli delle discussioni: (ri)leggete il regolamento
    No domande tecniche in messaggi privati

  5. #5
    Utente di HTML.it L'avatar di Mi|{y
    Registrato dal
    Apr 2003
    Messaggi
    117
    mm ho modificato li_searchIndex = ls_strippedResults.search( arg_ary_match[0] );
    con li_searchIndex = ls_strippedResults.search( arg_ary_match[i] );

    ora funge script free del caspita

  6. #6
    Utente di HTML.it L'avatar di Mi|{y
    Registrato dal
    Apr 2003
    Messaggi
    117
    però a volte mi da lo stesso errore bhaaaaaaaaaaaaa misterii!

    Lo script che stavo modificando è AspSimpleSearch per chi interessa e voglia utilizzarlo e testarlo mi mandi pure un'email l'ultima versione la si trova su http://blursoftware.com

  7. #7
    Utente di HTML.it L'avatar di willybit
    Registrato dal
    May 2001
    Messaggi
    4,367
    dovresti postare il contenuto dell'array arg_ary_match (che deve contenere regular expression)

  8. #8
    Utente di HTML.it L'avatar di Mi|{y
    Registrato dal
    Apr 2003
    Messaggi
    117
    non conosco bene il linguaggio ma credo inizi da li a riempire l'arrey che dicevi ciao grazie

    codice:
    //``````````````````````````````````````````````````
    //function getPageSummary( arg_s_fileContents, arg_ary_match )
    //-Argument(s):	arg_s_fileContents - the entire file text
    //				arg_ary_match - the array containing the found search terms
    //-Returns:		The finished summary text
    //-Description:	Scans the entire page for the search term, then pulls a bit of text
    //				before and after the found term. How much text it pulls is semi-random.
    //				It uses the number of characters in the lary_spacingBegining & 
    //				lary_spacingEnd arrays. This function also wraps the found term(s) 
    //				in a <span> tag so you can highlight it via CSS.
    //,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    function getPageSummary( arg_s_fileContents, arg_ary_match ) {
    	var lary_spacingBegining	= new Array( 30, 50, 70 );
    	var lary_spacingEnd			= new Array( 100, 80, 60 );
    	
    	var li_spacingBegining		= 0;
    	var li_spacingEnd			= 0;
    	var ls_summary				= "";
    	var ls_strippedResults		= "";
    	var ls_highlightedTerm		= "";
    	
    	var lreg_newLine			= /[\f\n\r\t]+/g;
    	var lreg_spaces				= / {2,}/g;
    	var lreg_htmlSpaces			= /(?:)*/gi;
    	
    	
    	//This randomizes the number of characters grabbed for the
    	//summary so all of the high lighting doesn't appear in the
    	//same place.
    	var lobj_Date		= new Date();
    	var i				= lobj_Date.getMilliseconds() % 3;
    	li_spacingBegining	= lary_spacingBegining[i];
    	li_spacingEnd		= lary_spacingEnd[i];
    	delete lobj_Date;
    	
    	//remove any new line characters and anything with more then 2 spaces.
    	ls_strippedResults	= arg_s_fileContents.replace( lreg_newLine,' ' ).replace( lreg_spaces, ' ' ).replace(lreg_htmlSpaces, '' );
    	li_searchIndex = ls_strippedResults.search( arg_ary_match[i] );
    	ls_summary = ls_strippedResults.substring( ( li_searchIndex - li_spacingBegining ), ( li_searchIndex + arg_ary_match[0].length + li_spacingEnd ) );
    
    	for ( var i=0; i<arg_ary_match.length; i++ ){
    		ls_highlightedTerm = '<span class="search_term">' + arg_ary_match[i] + '</span>';
    		if ( ls_summary.indexOf( ls_highlightedTerm ) == -1 )ls_summary = ls_summary.replace( arg_ary_match[i], ls_highlightedTerm );
    	}
    	
    	return ls_summary;
    }

  9. #9
    Utente di HTML.it L'avatar di willybit
    Registrato dal
    May 2001
    Messaggi
    4,367
    eh no... l'array è un parametro che viene passato alla funzione... dovresti postare la chiamata della funzione (e dove viene popolato il parametro)

  10. #10
    eh già scusa

    sono sempre miky da altro account

    Cmq è un pò un labirinto sto codice soprattutto per me



    sono funzioni che popolano altre funzioni

    var ls_pageSummary = getPageSummary( ls_strippedFileContents, lary_matches );
    var lary_matches = findMatch( ls_strippedFileContents, arg_reg_searchTerm );

    poimi son perso anche x' nn ho molto tempo ora.. magari domani ci guardo meglio anche se sarà dura
    ..meglio avere dei rimorsi che dei rimpianti!!

    Un saluto a tutti i progettisti Web

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.