IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Retirer texte d'une action javaScripts


Sujet :

VB.NET

  1. #1
    Membre actif
    Profil pro
    Inscrit en
    Février 2006
    Messages
    505
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 505
    Points : 293
    Points
    293
    Par défaut Retirer texte d'une action javaScripts
    Bonjour à tous

    Je me tourne vers vous afin de savoir si il est possible de récupérer les données de cette page et quelques indice sur la façon d'y arrivé??

    mon lien est http://web.tmxmoney.com/pricehistory...mbol=BBD.B:TSX

    je crois que mon but se situe dans cette partis du code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    <script type="text/javascript">
    $QM(document).ready(function () {
    	/*var trs=$QM('table').eq(3).find('tr');
    	var trInd = trs.length-2;
    	$QM(trs).eq(trInd).hide();*/
    	$QM('.historical-quote-input input[name=hq]').bind('keypress', function (event) {
    		if(event.keyCode==13) {
    			$QM('.historical-quote-input button').focus().trigger('click');
    		}
    	});
    	$QM('.historical-quote-input button').live('click', function () {
    		var qval = $QM('.historical-quote-input input[name=hq]').val();
    		if(hValidate(qval)) {
    			getHistoryData(qval);
    		} else {
    			alert('Veuillez indiquer une date valide (mm/jj/aaaa)');
    		}
    	});
        //$QM('.qmHistory .qm_historyData_row td').eq(8).hide();
    	function hValidate(input) {
    		// 30 days sept, april, june, november
    		// 28-29 feb
    		var dateRE=/^\d{2,2}\/\d{2,2}\/\d{4,4}$/g
    		if(input.match(dateRE)) {
    			var now = '1433016853';
    			var date_comp = new Date(input + ' 12:00');
    			var date_ts = Math.round(date_comp.getTime()/1000.0);
    			if(date_ts>now) {
    				return false;
    			}
    			var date = input.split('/');
    			if(date[0]>12) {
    				return false;
    			} else {
    				if(date[0]==4 || date[0]==6 || date[0]==9 || date[0]==11) {
    					if(date[1]>30) {
    						return false;
    					}
    				} else if(date[0]==2) {
    					if(date[1]>29) {
    						return false;
    					}
    				} else {
    					if(date[1]>31) {
    						return false;
    					}
    				}
    				return true;
    			}
    		} else {
    			return false;
    		}
    	}
    	function getHistoryData(_date) { 
    		var _date = _date.split('/');
    		var _xmldate = _date[2] + "/" + _date[0] + "/" + _date[1];
    		var qm_symbol = 'BBD.B:TSX';
    		$QM.getJSON('/json/getPriceHistory.json.php?callback=?', { 'qm_symbol': qm_symbol, 'date' : _xmldate }, function(json) {
    			var date = (typeof json === 'undefined') ? '' : json.history.date;
    						if(typeof json != 'undefined') {
    				var fr_mos = {
    					'January' : 'janvier',
    					'February' : 'f\u00E8vrier',
    					'March' : 'mars',
    					'April' : 'avril',
    					'May' : 'mai',
    					'June' : 'juin',
    					'July' : 'juillet',
    					'August' : 'ao\u00FBt',
    					'September' : 'septembre',
    					'October' : 'octobre',
    					'November' : 'novembre',
    					'December' : 'd\u00E8cembre'
    				};
    				var fr_day = {
    					'Monday' : 'Lundi',
    					'Tuesday' : 'Mardi',
    					'Wednesday' : 'Mercredi',
    					'Thursday' : 'Jeudi',
    					'Friday' : 'Vendredi',
    					'Saturday' : 'Samedi',
    					'Sunday' : 'Dimanche'
    				};
    				var fdate = date.split(',');
    				var mo_day = fdate[1];
    				mo_day = mo_day.split(" ");
    				mo_day[2] = (mo_day[2].length==1) ? 0+mo_day[2]:mo_day[2];
    				var date = fr_day[fdate[0]] + ' ' + mo_day[2] + ' ' + fr_mos[mo_day[1]] + ' ' + fdate[2];
    			}
    						$QM('.historical-quote-data .hq-date').html('<strong>'+date+'</strong>');
    			if(typeof json === 'undefined') {
    				$QM('.historical-quote-data .no-data').show();
    				$QM('.historical-quote-data table').hide();
    				$QM('.historical-quote-data .hq-date').hide();
    			} else {
    				$QM('.historical-quote-data .no-data').hide();
    				$QM('.historical-quote-data table').show();
    				$QM('.historical-quote-data .hq-date').show();
    				var eoddata = json.history.eoddata;
    				$QM('.historical-quote-data .open').text(eoddata.open!=0 ? eoddata.open : 's.o.');
    				$QM('.historical-quote-data .close').text(eoddata.close!=0 ? eoddata.close : 's.o.');
    				$QM('.historical-quote-data .high').text(eoddata.high!=0 ? eoddata.high : 's.o.');
    				$QM('.historical-quote-data .low').text(eoddata.low!=0 ? eoddata.low : 's.o.');
    				$QM('.historical-quote-data .volume').text(eoddata.sharevolume.toString());
    				if (typeof(eoddata.split)=="undefined") {
    					$QM('.no-splits').show();
    					$QM('.splits').hide();
    				}	else {
    					$QM('.no-splits').hide();
    					$QM('.splits').show();
    					$QM('.historical-quote-data .aprice').text(eoddata.unadjustedclose.toString());
    					var from = eoddata.split.forfactor.split(".");
    					from = (from[1]==0) ? from[0]:eoddata.split.forfactor;
     
    					var to = eoddata.split.tofactor.split(".");
    					to = (to[1]==0) ? to[0]:eoddata.split.tofactor;	
     
    					$QM('.historical-quote-data .afactor').text(to + ":" + from);
    				}
                    $QM('.historical-quote-data .triv').show().text(eoddata.triv);
    			}
    		});
    	}
    });
    </script>
    merci de vos conseils

  2. #2
    Membre actif
    Profil pro
    Inscrit en
    Février 2006
    Messages
    505
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 505
    Points : 293
    Points
    293
    Par défaut
    bon ok j'arrive à retirer les donner par les tagnames

    il me reste un problème à résoudre c'est de modifier la date par le code

    en gros mon code ressemble à ça

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            'http://web.tmxmoney.com/pricehistory.php?qm_symbol=MAA
            ToolStripTextBox1.Text = "http://web.tmxmoney.com/pricehistory.php?qm_symbol=MAA"
            WebBrowser1.Navigate(ToolStripTextBox1.Text)
        End Sub
     
        Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
            Dim BodyGr As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("TABLE")
     
            For Each BodyEl As HtmlElement In BodyGr
                Console.WriteLine(BodyEl.GetAttribute("Classname"))
                If BodyEl.GetAttribute("Classname") = "qm_history_historyContent" Then
                    Console.WriteLine()
                End If
                For Each el As HtmlElement In BodyEl.Document.All
                    'Console.WriteLine()
                Next
                Console.WriteLine()
            Next
     
     
     
        End Sub
    je me demande si je désire une autre date de recherche comment je procède ?

    merci

  3. #3
    Membre actif
    Profil pro
    Inscrit en
    Février 2006
    Messages
    505
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 505
    Points : 293
    Points
    293
    Par défaut
    rebonjour


    j'avance un peu voila ce que j'arrive à faire, j'arrive à incérer la date voulue dans le textbox mes il semble que mon click bouton ne la lise pas


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
     
    Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
     
            WebBrowser1.Document.All("endDateLite").SetAttribute("value", "01-01-2014")
            Dim Elems As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("button")
            For Each ElemB As HtmlElement In Elems
                If ElemB.GetAttribute("classname") = "qm_historySnapshot_GetQuoteButton" Then
                    Console.WriteLine()
     
                    ElemB.InvokeMember("click")
     
                End If
            Next
     
        End Sub
    une idée quelqu'un ?

    merci

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 3
    Dernier message: 05/08/2008, 11h17
  2. Initialiser un champ texte avec une fonction javascript
    Par Agoye dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 20/06/2006, 11h26
  3. Liens html pour un éditeur (ajouter une action javascript à un lien html)
    Par psychoBob dans le forum Général JavaScript
    Réponses: 17
    Dernier message: 25/05/2006, 18h41
  4. onChange pas déclanché sur une action javascript ?
    Par Oluha dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 27/06/2005, 16h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo